openssl/crypto/include/internal
Matt Caswell 99ba9fd02f Fix BN_hex2bn/BN_dec2bn NULL ptr/heap corruption
In the BN_hex2bn function the number of hex digits is calculated using
an int value |i|. Later |bn_expand| is called with a value of |i * 4|.
For large values of |i| this can result in |bn_expand| not allocating any
memory because |i * 4| is negative. This leaves ret->d as NULL leading
to a subsequent NULL ptr deref. For very large values of |i|, the
calculation |i * 4| could be a positive value smaller than |i|. In this
case memory is allocated to ret->d, but it is insufficiently sized
leading to heap corruption. A similar issue exists in BN_dec2bn.

This could have security consequences if BN_hex2bn/BN_dec2bn is ever
called by user applications with very large untrusted hex/dec data. This is
anticipated to be a rare occurrence.

All OpenSSL internal usage of this function uses data that is not expected
to be untrusted, e.g. config file data or application command line
arguments. If user developed applications generate config file data based
on untrusted data then it is possible that this could also lead to security
consequences. This is also anticipated to be a rare.

Issue reported by Guido Vranken.

CVE-2016-0797

Reviewed-by: Andy Polyakov <appro@openssl.org>
2016-02-29 16:32:18 +00:00
..
asn1_int.h Remove /* foo.c */ comments 2016-01-26 16:40:43 -05:00
async.h Correct copyright date for internal header file 2016-02-09 15:11:38 +00:00
bn_conf.h.in RT4339: Fix handling of <internal/bn_conf.h> 2016-02-23 13:18:23 -05:00
bn_dh.h Fix undeclared variable warnings. 2015-10-24 16:42:51 +01:00
bn_int.h Fix BN_hex2bn/BN_dec2bn NULL ptr/heap corruption 2016-02-29 16:32:18 +00:00
bn_srp.h Fix "defined but not used" warnings. 2015-09-11 18:16:23 +01:00
chacha.h Configure: make no-chacha and no-poly1305 work. 2015-12-10 12:05:50 +01:00
cryptlib.h Remove /* foo.c */ comments 2016-01-26 16:40:43 -05:00
cryptlib_int.h NULL the thread_local_inits_st pointer after use 2016-02-09 23:29:31 +00:00
ct_int.h Public API for Certificate Transparency 2016-02-26 14:57:29 -05:00
dso_conf.h.in Let Configure figure out the diverse shared library and DSO extensions 2016-02-19 11:51:23 +01:00
engine.h Auto init/deinit libcrypto 2016-02-09 15:11:38 +00:00
err.h Auto init/deinit libcrypto 2016-02-09 15:11:38 +00:00
evp_int.h Auto init/deinit libcrypto 2016-02-09 15:11:38 +00:00
md32_common.h Remove /* foo.c */ comments 2016-01-26 16:40:43 -05:00
poly1305.h Configure: make no-chacha and no-poly1305 work. 2015-12-10 12:05:50 +01:00
x509_int.h Remove /* foo.c */ comments 2016-01-26 16:40:43 -05:00