CVE-2017-1000158
Critical · 9.8CVSS
9.8
EPSS
7.9%
Published
Nov 17, 2017
CISA due date
—
Cloudanix analysis
Older versions of Python contain a flaw that lets attackers run their own code on affected systems if they can send specially crafted data, so organizations should update Python to stay protected.
- Exploitation
- Remote Unauthenticated
- Attacker needs
- None
- Complexity
- Low
- Impact
- Remote Code Execution
- Component
- Library
- Class
- Buffer Overflow
- Remediation
- Upgrade
- Effort
- Medium
- Patch risk
- Low
What it actually does
Integer overflow in PyString_DecodeEscape causes heap-based buffer overflow enabling potential arbitrary code execution in vulnerable CPython interpreters.
Why it matters to the business
Unpatched Python environments risk remote code execution that can lead to data theft, service disruption, or full system takeover across applications and dependent services.
How an attack unfolds
An attacker supplies a maliciously crafted string to any code path invoking PyString_DecodeEscape; the integer overflow miscalculates buffer size, resulting in a heap overflow that an attacker can leverage to overwrite memory structures and execute arbitrary code.
How to fix it
Upgrade python/cpython to commit ca079a3ea30098aff3197c559a0e32d42dda6d84 or later; upgrade policy-controller-fips and policy-controller-tester-fips to 0.8.4-r2 or later. Remove or isolate any remaining instances of Python 2.7.13 or earlier.
How to confirm the fix worked
Confirm installed Python versions exceed 2.7.13, run regression tests with known overflow-triggering inputs against PyString_DecodeEscape, and verify no vulnerable binaries remain in runtime paths.
Typical attack path
- Locate an exposed Python application or service that processes attacker-controlled input through string decoding routines
- Transmit a specially formed string designed to trigger the overflow in PyString_DecodeEscape
- Manipulate heap layout to achieve code execution and establish persistence or exfiltrate data
How to detect it
Search process execution logs and application telemetry for crashes or segmentation faults occurring during string decode operations; correlate with any services still running Python versions prior to the listed fixes.
What your security team should do
- Immediately inventory all Python 2.7.x deployments and schedule upgrades to fixed versions
- Block or sandbox services that still rely on unpatched Python interpreters until remediation completes
- Add version checks for Python runtimes to continuous compliance scanning
The record
CPython (aka Python) up to 2.7.13 is vulnerable to an integer overflow in the PyString_DecodeEscape function in stringobject.c, resulting in heap-based buffer overflow (and possible arbitrary code execution)
Affected packages
| Ecosystem | Package | Introduced | Fixed |
|---|---|---|---|
| Alpine:v3.4 | python | 0 | 2.7.14-r0 |
| Alpine:v3.5 | python2 | 0 | 2.7.14-r0 |
| Alpine:v3.6 | python2 | 0 | 2.7.14-r0 |
| Debian:11 | python2.7 | 0 | 2.7.13-4 |
| Debian:7 | python2.6 | 0 | 2.6.8-1.1+deb7u1 |
| Debian:7 | python2.7 | 0 | 2.7.3-6+deb7u4 |
| Debian:8 | python2.7 | 0 | 2.7.9-2+deb8u2 |
| Debian:8 | python3.4 | 0 | 3.4.2-1+deb8u1 |
| Debian:9 | python3.5 | 0 | 3.5.3-1+deb9u1 |
| Mageia:5 | python | 0 | 2.7.9-2.5.mga5 |
| Mageia:5 | python3 | 0 | 3.4.3-1.6.mga5 |
| Mageia:6 | python | 0 | 2.7.13-1.1.mga6 |
| Mageia:6 | python3 | 0 | 3.5.3-1.1.mga6 |
| SUSE:Enterprise Storage 5 | python | 0 | 2.7.13-28.3.2 |
| SUSE:Enterprise Storage 5 | python3 | 0 | 3.4.10-25.39.3 |
| SUSE:Enterprise Storage 5 | python3-base | 0 | 3.4.10-25.39.2 |
| SUSE:HPE Helion OpenStack 8 | python3 | 0 | 3.4.10-25.39.3 |
| SUSE:HPE Helion OpenStack 8 | python3-base | 0 | 3.4.10-25.39.2 |
| SUSE:Linux Enterprise Desktop 12 SP3 | python | 0 | 2.7.13-28.3.2 |
| SUSE:Linux Enterprise Desktop 12 SP3 | python-base | 0 | 2.7.13-28.3.2 |
| SUSE:Linux Enterprise Desktop 12 SP4 | python3 | 0 | 3.4.10-25.39.3 |
| SUSE:Linux Enterprise Desktop 12 SP4 | python3-base | 0 | 3.4.10-25.39.2 |
| SUSE:Linux Enterprise Module for Basesystem 15 | python | 0 | 2.7.17-7.32.2 |
| SUSE:Linux Enterprise Module for Basesystem 15 | python-base | 0 | 2.7.17-7.32.1 |
| SUSE:Linux Enterprise Module for Basesystem 15 SP1 | python | 0 | 2.7.17-7.32.2 |
| SUSE:Linux Enterprise Module for Basesystem 15 SP1 | python-base | 0 | 2.7.17-7.32.1 |
| SUSE:Linux Enterprise Module for Desktop Applications 15 | python | 0 | 2.7.17-7.32.2 |
| SUSE:Linux Enterprise Module for Desktop Applications 15 SP1 | python | 0 | 2.7.17-7.32.2 |
| SUSE:Linux Enterprise Module for Python 2 15 SP1 | python | 0 | 2.7.17-7.32.2 |
| SUSE:Linux Enterprise Module for Python 2 15 SP1 | python-base | 0 | 2.7.17-7.32.1 |
| SUSE:Linux Enterprise Module for Web and Scripting 12 | python3 | 0 | 3.4.10-25.39.3 |
| SUSE:Linux Enterprise Module for Web and Scripting 12 | python3-base | 0 | 3.4.10-25.39.2 |
| SUSE:Linux Enterprise Server 11 SP4 | python | 0 | 2.6.9-40.3.1 |
| SUSE:Linux Enterprise Server 11 SP4 | python-base | 0 | 2.6.9-40.3.1 |
| SUSE:Linux Enterprise Server 11 SP4 | python-doc | 0 | 2.6-8.40.3.1 |
| SUSE:Linux Enterprise Server 12 SP1-LTSS | python3 | 0 | 3.4.10-25.39.3 |
| SUSE:Linux Enterprise Server 12 SP1-LTSS | python3-base | 0 | 3.4.10-25.39.2 |
| SUSE:Linux Enterprise Server 12 SP2-BCL | python3 | 0 | 3.4.10-25.39.3 |
| SUSE:Linux Enterprise Server 12 SP2-BCL | python3-base | 0 | 3.4.10-25.39.2 |
| SUSE:Linux Enterprise Server 12 SP2-LTSS | python3 | 0 | 3.4.10-25.39.3 |
| SUSE:Linux Enterprise Server 12 SP2-LTSS | python3-base | 0 | 3.4.10-25.39.2 |
| SUSE:Linux Enterprise Server 12 SP3 | python | 0 | 2.7.13-28.3.2 |
| SUSE:Linux Enterprise Server 12 SP3 | python-base | 0 | 2.7.13-28.3.2 |
| SUSE:Linux Enterprise Server 12 SP3 | python-doc | 0 | 2.7.13-28.3.3 |
| SUSE:Linux Enterprise Server 12 SP3-BCL | python3 | 0 | 3.4.10-25.39.3 |
| SUSE:Linux Enterprise Server 12 SP3-BCL | python3-base | 0 | 3.4.10-25.39.2 |
| SUSE:Linux Enterprise Server 12 SP3-LTSS | python3 | 0 | 3.4.10-25.39.3 |
| SUSE:Linux Enterprise Server 12 SP3-LTSS | python3-base | 0 | 3.4.10-25.39.2 |
| SUSE:Linux Enterprise Server 12 SP4 | python3 | 0 | 3.4.10-25.39.3 |
| SUSE:Linux Enterprise Server 12 SP4 | python3-base | 0 | 3.4.10-25.39.2 |
| SUSE:Linux Enterprise Server 12 SP5 | python3 | 0 | 3.4.10-25.39.3 |
| SUSE:Linux Enterprise Server 12 SP5 | python3-base | 0 | 3.4.10-25.39.2 |
| SUSE:Linux Enterprise Server for SAP Applications 11 SP4 | python | 0 | 2.6.9-40.3.1 |
| SUSE:Linux Enterprise Server for SAP Applications 11 SP4 | python-base | 0 | 2.6.9-40.3.1 |
| SUSE:Linux Enterprise Server for SAP Applications 11 SP4 | python-doc | 0 | 2.6-8.40.3.1 |
| SUSE:Linux Enterprise Server for SAP Applications 12 SP1 | python3 | 0 | 3.4.10-25.39.3 |
| SUSE:Linux Enterprise Server for SAP Applications 12 SP1 | python3-base | 0 | 3.4.10-25.39.2 |
| SUSE:Linux Enterprise Server for SAP Applications 12 SP2 | python3 | 0 | 3.4.10-25.39.3 |
| SUSE:Linux Enterprise Server for SAP Applications 12 SP2 | python3-base | 0 | 3.4.10-25.39.2 |
| SUSE:Linux Enterprise Server for SAP Applications 12 SP3 | python | 0 | 2.7.13-28.3.2 |
| SUSE:Linux Enterprise Server for SAP Applications 12 SP3 | python-base | 0 | 2.7.13-28.3.2 |
| SUSE:Linux Enterprise Server for SAP Applications 12 SP3 | python-doc | 0 | 2.7.13-28.3.3 |
| SUSE:Linux Enterprise Server for SAP Applications 12 SP3 | python3 | 0 | 3.4.10-25.39.3 |
| SUSE:Linux Enterprise Server for SAP Applications 12 SP3 | python3-base | 0 | 3.4.10-25.39.2 |
| SUSE:Linux Enterprise Server for SAP Applications 12 SP4 | python3 | 0 | 3.4.10-25.39.3 |
| SUSE:Linux Enterprise Server for SAP Applications 12 SP4 | python3-base | 0 | 3.4.10-25.39.2 |
| SUSE:Linux Enterprise Server for SAP Applications 12 SP5 | python3 | 0 | 3.4.10-25.39.3 |
| SUSE:Linux Enterprise Server for SAP Applications 12 SP5 | python3-base | 0 | 3.4.10-25.39.2 |
| SUSE:Linux Enterprise Software Development Kit 11 SP4 | python | 0 | 2.6.9-40.3.1 |
| SUSE:Linux Enterprise Software Development Kit 11 SP4 | python-base | 0 | 2.6.9-40.3.1 |
| SUSE:Linux Enterprise Software Development Kit 11 SP4 | python-doc | 0 | 2.6-8.40.3.1 |
| SUSE:Linux Enterprise Software Development Kit 12 SP3 | python-base | 0 | 2.7.13-28.3.2 |
| SUSE:Linux Enterprise Software Development Kit 12 SP4 | python3 | 0 | 3.4.10-25.39.3 |
| SUSE:Linux Enterprise Software Development Kit 12 SP4 | python3-base | 0 | 3.4.10-25.39.2 |
| SUSE:Linux Enterprise Software Development Kit 12 SP5 | python3 | 0 | 3.4.10-25.39.3 |
| SUSE:Linux Enterprise Software Development Kit 12 SP5 | python3-base | 0 | 3.4.10-25.39.2 |
| SUSE:Linux Enterprise Workstation Extension 12 SP3 | python-base | 0 | 2.7.13-28.3.2 |
| SUSE:OpenStack Cloud 7 | python3 | 0 | 3.4.10-25.39.3 |
| SUSE:OpenStack Cloud 7 | python3-base | 0 | 3.4.10-25.39.2 |
| SUSE:OpenStack Cloud 8 | python3 | 0 | 3.4.10-25.39.3 |
| SUSE:OpenStack Cloud 8 | python3-base | 0 | 3.4.10-25.39.2 |
| SUSE:OpenStack Cloud Crowbar 8 | python3 | 0 | 3.4.10-25.39.3 |
| SUSE:OpenStack Cloud Crowbar 8 | python3-base | 0 | 3.4.10-25.39.2 |
| Ubuntu:14.04:LTS | python2.7 | 0 | 2.7.6-8ubuntu0.4 |
| Ubuntu:14.04:LTS | python3.4 | 0 | 3.4.3-1ubuntu1~14.04.6 |
| Ubuntu:14.04:LTS | python3.5 | 0 | 3.5.2-2ubuntu0~16.04.4~14.04.1 |
| Ubuntu:16.04:LTS | python2.7 | 0 | 2.7.12-1ubuntu0~16.04.2 |
| Ubuntu:16.04:LTS | python3.5 | 0 | 3.5.2-2ubuntu0~16.04.4 |
| openSUSE:Tumbleweed | python | 0 | 2.7.18-8.1 |
Related vulnerabilities
- CVE-2024-9287 A vulnerability has been found in the CPython `venv` module and CLI where path names… Also affects python2.7
- CVE-2024-6232 There is a MEDIUM severity vulnerability affecting CPython. Also affects python2.7
- CVE-2024-8088 There is a HIGH severity vulnerability affecting the CPython "zipfile" module affecting… Also affects python2.7
- CVE-2024-6923 There is a MEDIUM severity vulnerability affecting CPython. Also affects python2.7
- CVE-2024-5642 CPython 3.9 and earlier doesn't disallow configuring an empty list ("[]") for… Also affects python2.7
- CVE-2024-0397 A defect was discovered in the Python “ssl” module where there is a memory race condition… Also affects python2.7
- CVE-2024-0450 An issue was found in the CPython `zipfile` module affecting versions 3.12.1, 3.11.7… Also affects python2.7
- CVE-2023-27043 The email module of Python through 3.11.3 incorrectly parses e-mail addresses that… Also affects python2.7