Python 2.5.2 and earlier allows context-dependent attackers to execute arbitrary code via multiple vectors that cause a negative size value
Python 2.5.2 and earlier allows context-dependent attackers to execute arbitrary code via multiple vectors that cause a negative size value to be provided to the PyString_FromStringAndSize function, which allocates less memory than expected when assert() is disabled and triggers a buffer overflow.
- Published
- Apr 18, 2008
- Updated
- Jun 16, 2026
- EPSS
- 6.3% · 93th percentile
- CWE
- CWE-120
Sign in to follow · You’ll be notified if a followed record enters KEV, gets an exploit or is updated.
Report tools
Action score
39
Monitor
Low priority for now.
- CVSS
- 37 / 40 · 9.3 / 10
- CISA KEV
- 0 / 30 · Not listed
- EPSS
- 2 / 30 · 6.3%
Affected systems
| Vendor | Product | CPE |
|---|---|---|
| python | python | cpe:2.3:a:python:python |
| canonical | ubuntu linux | cpe:2.3:o:canonical:ubuntu_linux |
| debian | debian linux | cpe:2.3:o:debian:debian_linux |
Affected versions
NVD version ranges (for catalog products). Add the product to your stack with a version and matching uses these.
- canonical ubuntu linux6.06
- canonical ubuntu linux7.04
- canonical ubuntu linux7.10
- canonical ubuntu linux8.04
- debian debian linux4.0
- python pythonup to 2.5.2 inclusive
Package-level exposure
OSV and GitHub Advisory data: ecosystem, package and range. SBOM matching uses this table.
| Ecosystem | Package | Affected range | Fix |
|---|---|---|---|
| Debian:4.0 | python2.4 | before 2.4.4-3+etch1 | 2.4.4-3+etch1 |
| Debian:4.0 | python2.5 | before 2.5-5+etch1 | 2.5-5+etch1 |
| Red Hat:enterprise_linux:3::as | python | before 0:2.2.3-6.11 | 0:2.2.3-6.11 |
| Red Hat:enterprise_linux:3::as | python-debuginfo | before 0:2.2.3-6.11 | 0:2.2.3-6.11 |
| Red Hat:enterprise_linux:3::as | python-devel | before 0:2.2.3-6.11 | 0:2.2.3-6.11 |
| Red Hat:enterprise_linux:3::as | python-tools | before 0:2.2.3-6.11 | 0:2.2.3-6.11 |
| Red Hat:enterprise_linux:3::as | tkinter | before 0:2.2.3-6.11 | 0:2.2.3-6.11 |
| Red Hat:enterprise_linux:4::as | python | before 0:2.3.4-14.7.el4_8.2 | 0:2.3.4-14.7.el4_8.2 |
| Red Hat:enterprise_linux:4::as | python-debuginfo | before 0:2.3.4-14.7.el4_8.2 | 0:2.3.4-14.7.el4_8.2 |
| Red Hat:enterprise_linux:4::as | python-devel | before 0:2.3.4-14.7.el4_8.2 | 0:2.3.4-14.7.el4_8.2 |
| Red Hat:enterprise_linux:4::as | python-docs | before 0:2.3.4-14.7.el4_8.2 | 0:2.3.4-14.7.el4_8.2 |
| Red Hat:enterprise_linux:4::as | python-tools | before 0:2.3.4-14.7.el4_8.2 | 0:2.3.4-14.7.el4_8.2 |
| Red Hat:enterprise_linux:4::as | tkinter | before 0:2.3.4-14.7.el4_8.2 | 0:2.3.4-14.7.el4_8.2 |
| Red Hat:enterprise_linux:5::client | python-tools | before 0:2.4.3-24.el5_3.6 | 0:2.4.3-24.el5_3.6 |
| Red Hat:enterprise_linux:5::client | tkinter | before 0:2.4.3-24.el5_3.6 | 0:2.4.3-24.el5_3.6 |
| Red Hat:enterprise_linux:5::client_workstation | python | before 0:2.4.3-24.el5_3.6 | 0:2.4.3-24.el5_3.6 |
| Red Hat:enterprise_linux:5::client_workstation | python-debuginfo | before 0:2.4.3-24.el5_3.6 | 0:2.4.3-24.el5_3.6 |
| Red Hat:enterprise_linux:5::client_workstation | python-devel | before 0:2.4.3-24.el5_3.6 | 0:2.4.3-24.el5_3.6 |
Same product
python: all recordsOther highest-scoring records for the same primary product.
- CVE-2016-5636Integer overflow in the get_data 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 all47Plan
- CVE-2007-4559Directory traversal vulnerability in the (1) extract and (2) extractall functions in the tarfile module in Python allows user-assisted remot47Plan
- CVE-2021-3177Python 3.x through 3.9.1 has a buffer overflow in PyCArg_repr in _ctypes/callproc.c, which may lead to remote code execution in certain Pyth46Plan
- CVE-2014-4650The CGIHTTPServer module in Python 2.7.5 and 3.3.4 does not properly handle URLs in which URL encoding is used for path separators, which al46Plan
- CVE-2018-1000802Python Software Foundation Python (CPython) version 2.7 contains a CWE-77: Improper Neutralization of Special Elements used in a Command ('C45Plan
- CVE-2020-27619In Python 3 through 3.9.0, the Lib/test/multibytecodec_support.py CJK codec tests call eval() on content retrieved via HTTP.42Plan
Remediation
Which version to upgrade to
Fix versions compiled from the vendor, package registries and Microsoft. Verify the vendor's note before upgrading.
| Product / package | Fixed version | Source |
|---|---|---|
| debian:python2.4 | 2.4.4-3+etch1 · Debian:4.0 | Package registry (OSV) |
| debian:python2.5 | 2.5-5+etch1 · Debian:4.0 | Package registry (OSV) |
| red hat:python | 0:2.4.3-24.el5_3.6 · Red Hat:enterprise_linux:5::client_workstation | Package registry (OSV) |
| red hat:python-debuginfo | 0:2.4.3-24.el5_3.6 · Red Hat:enterprise_linux:5::client_workstation | Package registry (OSV) |
| red hat:python-devel | 0:2.4.3-24.el5_3.6 · Red Hat:enterprise_linux:5::client_workstation | Package registry (OSV) |
| red hat:python-docs | 0:2.3.4-14.7.el4_8.2 · Red Hat:enterprise_linux:4::as | Package registry (OSV) |
| red hat:python-tools | 0:2.4.3-24.el5_3.6 · Red Hat:enterprise_linux:5::client | Package registry (OSV) |
| red hat:tkinter | 0:2.4.3-24.el5_3.6 · Red Hat:enterprise_linux:5::client | Package registry (OSV) |
Exploit status
No known public exploit
No public exploit has been observed yet. That doesn't mean you're safe, only that the bar is a little higher.
Research context
For pentesters and researchers: attack profile, score disagreement, timeline, patch commits, credits, variant and chain candidates, bug bounty scope. All derived from existing data; no exploit code.
Timeline
From publication to today: proof of concept, Metasploit module, CISA KEV and fix record. Dates are as reported by the sources.
No dated events beyond publication.
FIRST EPSS daily score; only changes of 0.01 or more are recorded (step chart).
Patch and commit links
Commit, PR and diff links among the references. A starting point for patch-diffing and variant hunting; fixes, not exploits.
No commit or PR link among the references.
Credits
All researchersFinders, reporters and analysts named in the CNA record. Click a name for that researcher’s other records.
No credits in the CNA record.
Variant candidates
Same product, same weakness class, within 18 months. If the patch missed the root cause, the sibling bug is here.
No nightly-computed relations.
Chain candidates
An authentication bypass and a privilege-requiring bug in the same product, published close together: combined they may become an unauthenticated path.
—
Bug bounty scope
No known public program.
Source: bounty-targets-data (public HackerOne, Bugcrowd, Intigriti, YesWeHack listings).
Technical details
Attack conditions
If successful
- Confidentiality
- C · data can be read
- Integrity
- C · data or configuration can be modified
- Availability
- C · the service can be disrupted
- Attack complexity
- M
- Confidentiality impact
- C
- Integrity impact
- C
- Availability impact
- C
Weakness class (CWE)
CWE-120 · Buffer Copy without Checking Size of Input ('Classic Buffer Overflow')CVSS vector
AV:N/AC:M/Au:N/C:C/I:C/A:C
nvd-primary
Root cause
When data is copied, the source length is not compared with the size of the destination buffer. Excess data overwrites adjacent memory.
The bug in code
The whole CWE-120 classA representative example of this vulnerability class. Not the vendor's source code; it shows the faulty pattern and its fix.
Vulnerable
char buf[256];memcpy(buf, pkt->data, pkt->len);Fixed
char buf[256];if (pkt->len > sizeof(buf)) { return -EINVAL;}memcpy(buf, pkt->data, pkt->len);Attack context
MITRE CAPEC attack patterns and ATT&CK techniques for this weakness class (CWE). A starting point for detection rules and threat hunting.
Attack patterns (CAPEC)
- Buffer Overflow via Environment VariablesCAPEC-10likelihood: High · High
- Overflow BuffersCAPEC-100likelihood: High · Very High
- Client-side Injection-induced Buffer OverflowCAPEC-14likelihood: Medium · High
- Filter Failure through Buffer OverflowCAPEC-24likelihood: High · High
- MIME ConversionCAPEC-42likelihood: High · High
- Overflow Binary Resource FileCAPEC-44likelihood: High · Very High
- Buffer Overflow via Symbolic LinksCAPEC-45likelihood: High · High
- Overflow Variables and TagsCAPEC-46likelihood: High · High
ATT&CK techniques
—
Noroxi analysis
No Noroxi analysis for this record yet
We don't hand-write analysis for all 385,000+ vulnerabilities; that wouldn't be honest. For notable, high-impact vulnerabilities our team writes the mechanism, detection and remediation steps.
We use this product, ask for helpChange log
- Fix✗ → ✓
For records you follow, these changes also arrive as notifications. →
References
- lists.apple.com/archives/security-announce/2009/Feb/msg00000.html
- lists.opensuse.org/opensuse-security-announce/2008-08/msg00006.html
- secunia.com/advisories/29889
- secunia.com/advisories/30872
- secunia.com/advisories/31255
- secunia.com/advisories/31365
- secunia.com/advisories/31518
- secunia.com/advisories/31687
- secunia.com/advisories/33937
- secunia.com/advisories/37471
- security.gentoo.org/glsa/glsa-200807-01.xml
- support.apple.com/kb/HT3438
- wiki.rpath.com/wiki/Advisories:rPSA-2009-0122
- www.debian.org/security/2008/dsa-1551
- www.debian.org/security/2008/dsa-1620
- www.novell.com/support/search.do?cmd=displayKC&docType=kc&externalId=InfoDocument-patchbuilder-readme5032900
- www.securityfocus.com/archive/1/506056/100/0/threaded
- www.securityfocus.com/archive/1/507985/100/0/threaded
- www.securityfocus.com/bid/28749
- www.ubuntu.com/usn/usn-632-1
Vendor advisories and official records. Exploit/PoC links are deliberately left out.