CVE-2016-0797: Integer Overflow
As per Upstream advisory:
In the BNhex2bn function the number of hex digits is calculated using an int value |i|. Later |bnexpand| is called with a value of |i 4|. For large values of |i| this can result in |bnexpand| not allocating any memory because |i 4| is negative. This can leave the internal BIGNUM data field 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 the internal BIGNUM data field, but it is insufficiently sized leading to heap corruption. A similar issue exists in BNdec2bn. This could have security consequences if BNhex2bn/BNdec2bn 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 these functions use 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 rare.
This issue affects OpenSSL versions 1.0.2 and 1.0.1.
OpenSSL 1.0.2 users should upgrade to 1.0.2g OpenSSL 1.0.1 users should upgrade to 1.0.1s
This issue was reported to OpenSSL on February 19th 2016 by Guido Vranken. The fix was developed by Matt Caswell of the OpenSSL development team.
Other sources
Multiple integer overflows in OpenSSL 1.0.1 before 1.0.1s and 1.0.2 before 1.0.2g allow remote attackers to cause a denial of service (heap memory corruption or NULL pointer dereference) or possibly have unspecified other impact via a long digit string that is mishandled by the (1) BNdec2bn or (2) BNhex2bn function, related to crypto/bn/bn.h and crypto/bn/bnprint.c.
— MITRE
Affected Software
Remediation
Event History
Frequently Asked Questions
What is the severity of CVE-2016-0797?
CVE-2016-0797 has been assigned a severity rating of high due to the potential for denial of service.
How do I fix CVE-2016-0797?
To fix CVE-2016-0797, upgrade your OpenSSL package to version 1.0.1t or 1.0.2d and later.
Which versions of OpenSSL are affected by CVE-2016-0797?
CVE-2016-0797 affects OpenSSL versions 1.0.1 through 1.0.1s and version 1.0.2 through 1.0.2c.
What is the impact of CVE-2016-0797?
The impact of CVE-2016-0797 is that it can lead to denial of service due to memory allocation issues.
Is there any workaround for CVE-2016-0797 if I cannot upgrade OpenSSL?
While the best practice is to upgrade, there are no effective workarounds recommended for CVE-2016-0797.