Bugzilla will be upgraded to version 5.0 on a still to be determined date in the near future. The original upgrade date has been delayed.
Bug 1345856 - (CVE-2016-5636) CVE-2016-5636 python: Heap overflow in zipimporter module
CVE-2016-5636 python: Heap overflow in zipimporter module
Status: ASSIGNED
Product: Security Response
Classification: Other
Component: vulnerability (Show other bugs)
unspecified
All Linux
low Severity low
: ---
: ---
Assigned To: Red Hat Product Security
impact=low,public=20160121,reported=2...
: Reopened, Security
Depends On: 1345857 1345858 1345859 1345860 1345861 1356364 1356365
Blocks: 1323912 1345863
  Show dependency treegraph
 
Reported: 2016-06-13 06:38 EDT by Adam Mariš
Modified: 2018-08-27 17:30 EDT (History)
28 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
A vulnerability was discovered in Python, in the built-in zipimporter. A specially crafted zip file placed in a module path such that it would be loaded by a later "import" statement could cause a heap overflow, leading to arbitrary code execution.
Story Points: ---
Clone Of:
Environment:
Last Closed: 2016-07-13 03:33:12 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2016:2586 normal SHIPPED_LIVE Low: python security, bug fix, and enhancement update 2016-11-03 08:09:15 EDT

  None (edit)
Description Adam Mariš 2016-06-13 06:38:12 EDT
A heap-based buffer overflow vulnerability was found in zipimporter module.

Vulnerable code:

  1116     bytes_size = compress == 0 ? data_size : data_size + 1;
  1117     if (bytes_size == 0)
  1118         bytes_size++;
  1119     raw_data = PyBytes_FromStringAndSize((char *)NULL, bytes_size);

data_size is not sanitized, so if comepress != 0 and data_size = -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
Comment 1 Adam Mariš 2016-06-13 06:39:48 EDT
Created python tracking bugs for this issue:

Affects: fedora-all [bug 1345858]
Comment 2 Adam Mariš 2016-06-13 06:39:59 EDT
Created jython tracking bugs for this issue:

Affects: fedora-all [bug 1345857]
Affects: epel-5 [bug 1345861]
Comment 3 Adam Mariš 2016-06-13 06:40:11 EDT
Created python26 tracking bugs for this issue:

Affects: epel-5 [bug 1345860]
Comment 4 Adam Mariš 2016-06-13 06:40:19 EDT
Created python3 tracking bugs for this issue:

Affects: fedora-all [bug 1345859]
Comment 5 Doran Moppert 2016-06-14 21:27:47 EDT
The patches identified in comment#0 and upstream tracker are not complete and do not prevent the attached "crash.py" reproducer.  These do:

Upstream patches:

https://hg.python.org/cpython/rev/2edbdb79cd6d (2.7)
https://hg.python.org/cpython/rev/8b58c9328f5c (3.4)
https://hg.python.org/cpython/rev/5533a9e02b21 (3.5)
https://hg.python.org/cpython/rev/0f46c9a5735f (default)
Comment 7 Andrej Nemec 2016-06-16 08:50:30 EDT
CVE assignment:

http://seclists.org/oss-sec/2016/q2/560
Comment 8 Doran Moppert 2016-07-13 03:01:07 EDT
To exploit this flaw, an attacker would need to be able to place crafted files on the python import path.  Since this already presents the opportunity for arbitrary code execution, this issue is rated as having Low security impact.

Further, the flaw is not present in either PyPy or Jython, but only in the CPython interpreter.  CPython is known to be unsuitable to create a sandbox for running untrusted user code; for this purpose either PyPy or Jython are suggested as a better fountation.
Comment 9 Doran Moppert 2016-07-13 03:28:22 EDT
Statement:

Red Hat Product Security has rated this issue as having Low security impact. This issue is not currently planned to be addressed in future updates. For additional information, refer to the Issue Severity Classification: https://access.redhat.com/security/updates/classification/.
Comment 11 Doran Moppert 2016-07-13 22:33:44 EDT
Created python34 tracking bugs for this issue:

Affects: epel-7 [bug 1356365]
Comment 12 errata-xmlrpc 2016-11-03 16:17:01 EDT
This issue has been addressed in the following products:

  Red Hat Enterprise Linux 7

Via RHSA-2016:2586 https://rhn.redhat.com/errata/RHSA-2016-2586.html

Note You need to log in before you can comment on or make changes to this bug.