openssl/crypto/bn
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
..
asm GH601: Various spelling fixes. 2016-02-05 15:25:50 -05:00
bn_add.c Remove /* foo.c */ comments 2016-01-26 16:40:43 -05:00
bn_asm.c Remove /* foo.c */ comments 2016-01-26 16:40:43 -05:00
bn_blind.c Remove /* foo.c */ comments 2016-01-26 16:40:43 -05:00
bn_const.c Remove /* foo.c */ comments 2016-01-26 16:40:43 -05:00
bn_ctx.c Remove outdated DEBUG flags. 2016-02-18 17:14:50 -05:00
bn_depr.c Use NON_EMPTY_TRANSLATION_UNIT, consistently. 2016-02-09 20:13:29 -05:00
bn_dh.c Fix undeclared variable warnings. 2015-10-24 16:42:51 +01:00
bn_div.c Move more BN internals to bn_lcl.h 2016-01-30 16:54:35 -05:00
bn_err.c Remove /* foo.c */ comments 2016-01-26 16:40:43 -05:00
bn_exp2.c Remove /* foo.c */ comments 2016-01-26 16:40:43 -05:00
bn_exp.c Remove /* foo.c */ comments 2016-01-26 16:40:43 -05:00
bn_gcd.c GH601: Various spelling fixes. 2016-02-05 15:25:50 -05:00
bn_gf2m.c Remove /* foo.c */ comments 2016-01-26 16:40:43 -05:00
bn_intern.c Continue standardising malloc style for libcrypto 2015-11-09 22:48:41 +00:00
bn_kron.c GH601: Various spelling fixes. 2016-02-05 15:25:50 -05:00
bn_lcl.h Fix BN_hex2bn/BN_dec2bn NULL ptr/heap corruption 2016-02-29 16:32:18 +00:00
bn_lib.c GH601: Various spelling fixes. 2016-02-05 15:25:50 -05:00
bn_mod.c Remove /* foo.c */ comments 2016-01-26 16:40:43 -05:00
bn_mont.c Remove /* foo.c */ comments 2016-01-26 16:40:43 -05:00
bn_mpi.c Remove /* foo.c */ comments 2016-01-26 16:40:43 -05:00
bn_mul.c GH601: Various spelling fixes. 2016-02-05 15:25:50 -05:00
bn_nist.c GH601: Various spelling fixes. 2016-02-05 15:25:50 -05:00
bn_prime.c Restore NUMPRIMES as a numeric literal 2016-01-28 06:36:55 -05:00
bn_prime.h Restore NUMPRIMES as a numeric literal 2016-01-28 06:36:55 -05:00
bn_prime.pl Restore NUMPRIMES as a numeric literal 2016-01-28 06:36:55 -05:00
bn_print.c Fix BN_hex2bn/BN_dec2bn NULL ptr/heap corruption 2016-02-29 16:32:18 +00:00
bn_rand.c Remove /* foo.c */ comments 2016-01-26 16:40:43 -05:00
bn_recp.c GH678: Add a few more zalloc 2016-02-22 12:13:37 -05:00
bn_shift.c Remove /* foo.c */ comments 2016-01-26 16:40:43 -05:00
bn_sqr.c Remove /* foo.c */ comments 2016-01-26 16:40:43 -05:00
bn_sqrt.c Remove /* foo.c */ comments 2016-01-26 16:40:43 -05:00
bn_srp.c Only include SRP headers when OPENSSL_NO_SRP is undefined 2015-10-22 23:45:45 +02:00
bn_word.c Remove /* foo.c */ comments 2016-01-26 16:40:43 -05:00
bn_x931p.c GH601: Various spelling fixes. 2016-02-05 15:25:50 -05:00
build.info In the unified scheme, there is no $(TOP), use $(SRCDIR) instead 2016-02-18 00:38:26 +01:00
Makefile.in Always build library object files with shared library cflags 2016-02-20 16:51:31 +01:00
rsaz_exp.c Missing header include. 2016-02-11 08:47:57 -05:00
rsaz_exp.h rsaz_exp.h: align license with the rest of the contribution 2015-07-23 14:20:28 +02:00
vms-helper.c Remove /* foo.c */ comments 2016-01-26 16:40:43 -05:00