CVE-2016-5636: Buffer Overflow

Published Jun 13, 2016
·
Updated

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

34 affected componentsFixes available
Python Python=3.0
Python Python=3.0.1
Python Python=3.1.0
Python Python=3.1.1
Python Python=3.1.2
Python Python=3.1.3
Python Python=3.1.4
Python Python=3.1.5
Python Python=3.2.0
Python Python=3.2.1
Python Python=3.2.2
Python Python=3.2.3
Python Python=3.2.4
Python Python=3.2.5
Python Python=3.2.6
Python Python=3.3.0
Python Python=3.3.1
Python Python=3.3.2
Python Python=3.3.3
Python Python=3.3.4
Python Python=3.3.5
Python Python=3.3.6
Python Python=3.4.0
Python Python=3.4.1
Python Python=3.4.2
Python Python=3.4.3
Python Python=3.4.4
Python Python<=2.7.11
Python Python=3.5.0
Python Python=3.5.1
debian/python2.7<2.7.12~rc1-1
2.7.12~rc1-1
debian/python2.7
2.7.3-6+deb7u32.7.9-2+deb8u12.7.12~rc1-1
debian/python3.4
3.4.2-1+deb8u2
debian/python3.5
3.5.2~rc1-1

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade debian/python2.7 to a version that resolves this vulnerability.

    Fixed in 2.7.12~rc1-1
  2. Upgrade

    Upgrade debian/python2.7 to 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
  3. Upgrade

    Upgrade debian/python3.4 to a version that resolves this vulnerability.

    Fixed in 3.4.2-1+deb8u2
  4. Upgrade

    Upgrade debian/python3.5 to a version that resolves this vulnerability.

    Fixed in 3.5.2~rc1-1
  5. Upgrade

    Upgrade CPython to a version that resolves this vulnerability.

    Fixed in 2.7.12
  6. Upgrade

    Upgrade CPython to a version that resolves this vulnerability.

    Fixed in 3.4.5
  7. Upgrade

    Upgrade CPython to a version that resolves this vulnerability.

    Fixed in 3.5.2

Event History

Jun 13, 2016
Data Sourced
via Red Hat·10:38 AM
DescriptionSeverityAffected Software
Sep 2, 2016
CVE Published
via MITRE·02:00 PM
Data Sourced
via MITRE·02:00 PM
Description
Data Sourced
02:59 PM
RemedyDescriptionSeverityWeaknessAffected Software
Data Sourced
via OSV·02:59 PM
DescriptionSeverity
Feb 9, 2019
Event
11:29 AM
Oct 21, 2026
Data Sourced
via Microsoft·08:06 AM
DescriptionSeverityWeakness
Nov 24, 2026
Withdrawn
via OSV·04:29 AM
Data Sourced
via OSV·04:29 AM
Affected Software

Peer vulnerabilities

Found alongside the following vulnerabilities.

Frequently Asked Questions

1

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.

2

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.

3

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.

4

Can CVE-2016-5636 be exploited remotely?

Yes, CVE-2016-5636 can be exploited by remote attackers through a negative data size value.

5

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.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203