CVE-2016-5636: Buffer Overflow
A heap-based buffer overflow vulnerability was found in zipimporter module.
Vulnerable code:
1116 bytessize = compress == 0 ? datasize : datasize + 1; 1117 if (bytessize == 0) 1118 bytessize++; 1119 rawdata = PyBytesFromStringAndSize((char )NULL, bytessize);
datasize is not sanitized, so if comepress != 0 and datasize = -1, then it overflows and becomes 0. Right after then it's incremented and becomes 1. In that case, python allocates small portion of heap, which is later overflowed using fread.
Upstream bug:
https://bugs.python.org/issue26171
Upstream patches:
https://hg.python.org/cpython/rev/01ddd608b85c (3.4) https://hg.python.org/cpython/rev/985fc64c60d6 (2.7) https://hg.python.org/cpython/rev/10dad6da1b28 (3.5) https://hg.python.org/cpython/rev/2df462852464 (default)
CVE request:
http://seclists.org/oss-sec/2016/q2/524
Other sources
Integer overflow in the getdata function in zipimport.c in CPython (aka Python) before 2.7.12, 3.x before 3.4.5, and 3.5.x before 3.5.2 allows remote attackers to have unspecified impact via a negative data size value, which triggers a heap-based buffer overflow.
— MITRE
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
debian/python2.7to a version that resolves this vulnerability.Fixed in 2.7.12~rc1-1 - Upgrade
Upgrade
debian/python2.7to a version that resolves this vulnerability.Fixed in 2.7.3-6+deb7u3Fixed in 2.7.9-2+deb8u1Fixed in 2.7.12~rc1-1 - Upgrade
Upgrade
debian/python3.4to a version that resolves this vulnerability.Fixed in 3.4.2-1+deb8u2 - Upgrade
Upgrade
debian/python3.5to a version that resolves this vulnerability.Fixed in 3.5.2~rc1-1 - Upgrade
Upgrade
CPythonto a version that resolves this vulnerability.Fixed in 2.7.12 - Upgrade
Upgrade
CPythonto a version that resolves this vulnerability.Fixed in 3.4.5 - Upgrade
Upgrade
CPythonto a version that resolves this vulnerability.Fixed in 3.5.2
Event History
Frequently Asked Questions
What is the severity of CVE-2016-5636?
CVE-2016-5636 has a severity rating that can lead to a heap-based buffer overflow, potentially allowing remote attackers to affect the application.
How do I fix CVE-2016-5636?
To address CVE-2016-5636, upgrade to Python versions 2.7.12, 3.4.5, or 3.5.2 or later.
What versions of Python are affected by CVE-2016-5636?
CVE-2016-5636 affects Python versions prior to 2.7.12, 3.4.5, and 3.5.2.
Can CVE-2016-5636 be exploited remotely?
Yes, CVE-2016-5636 can be exploited by remote attackers through a negative data size value.
What is the impact of CVE-2016-5636?
The impact of CVE-2016-5636 includes potential arbitrary code execution and application instability due to a buffer overflow.