CVE-2007-2052: Medium severity Python Software Foundation Python vulnerability

Published Apr 3, 2007
·
Updated

Description of problem:

Modules/localemodule.c:361 356 n1 = strlen(s) + 1; 357 buf = PyMemMalloc(n1); 358 if (!buf) 359 return PyErrNoMemory(); 360 n2 = strxfrm(buf, s, n1);

In case the transformed string is longer than original string... (see the PoC for an exapmle)

361 if (n2 > n1) { 362 / more space needed /

We allocate n2 bytes here:

363 buf = PyMemRealloc(buf, n2); 364 if (!buf) 365 return PyErrNoMemory();

And here the string will be n2 chars long and terminating NUL won't fit and thus the string won't be terminated what can lead to an information leak in certain rare cases (see the original Debian report for details).

366 strxfrm(buf, s, n2); 367 } 368 result = PyStringFromString(buf); 369 PyMemFree(buf); 370 return result; 371 } 372 373 #if defined(MSWINDOWS) 374 static PyObject 375 PyLocalegetdefaultlocale(PyObject self)

Version-Release number of selected component (if applicable):

FC5, FC6, RHEL2.1, RHEL3, RHEL4, RHEL5

How reproducible:

Proof of concept code attached.

Additional info:

See the URL for an original bug report to Debian and PoC by Piotr Engelking. It contains details on how to reproduce and recognize the flaw.

Other sources

Off-by-one error in the PyLocalestrxfrm function in Modules/localemodule.c for Python 2.4 and 2.5 causes an incorrect buffer size to be used for the strxfrm function, which allows context-dependent attackers to read portions of memory via unknown manipulations that trigger a buffer over-read due to missing null termination.

Affected Software

4 affected components
Python Software Foundation Python=2.4
Python Software Foundation Python=2.5
Python Python=2.4.0
Python Python=2.5.0

Event History

Apr 3, 2007
Data Sourced
via Red Hat·06:55 PM
DescriptionSeverityAffected Software
Apr 16, 2007
CVE Published
via MITRE·10:00 PM
Data Sourced
via MITRE·10:00 PM
Description
Data Sourced
10:19 PM
DescriptionWeaknessAffected Software
Data Sourced
10:19 PM
Severity
Data Sourced
via NVD·10:19 PM
DescriptionSeverityWeaknessAffected Software
Apr 17, 2007
CVE Published
via MITRE·02:00 AM

Frequently Asked Questions

1

What is the severity of CVE-2007-2052?

CVE-2007-2052 is considered to have a medium severity rating due to its potential for memory reading attacks.

2

How do I fix CVE-2007-2052?

To fix CVE-2007-2052, upgrade to Python version 2.6 or later as these versions contain the necessary patches.

3

Which versions of Python are affected by CVE-2007-2052?

CVE-2007-2052 affects Python versions 2.4.0 and 2.5.0.

4

What type of vulnerability is CVE-2007-2052?

CVE-2007-2052 is classified as a buffer over-read vulnerability caused by an off-by-one error.

5

Can CVE-2007-2052 be exploited remotely?

Yes, CVE-2007-2052 can be exploited remotely by attackers through context-dependent methods.

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