Python PyString_FromStringAndSize() buffer overflow

python-pystringfromstringandsize-bo (41944) The risk level is classified as HighHigh Risk

Description:

Python is vulnerable to a buffer overflow, caused by improper bounds checking when assert() is disabled. By passing a negative size value to the PyString_FromStringAndSize() function, a remote attacker could overflow a buffer and execute arbitrary code on the system with elevated privileges or cause the application to crash.

Platforms Affected:

  • Apple, Mac OS X 10.4.11
  • Apple, Mac OS X 10.5.6
  • Apple, Mac OS X Server 10.4.11
  • Apple, Mac OS X Server 10.5.6
  • Canonical, Ubuntu 6.06 LTS
  • Canonical, Ubuntu 7.04
  • Canonical, Ubuntu 7.10
  • Canonical, Ubuntu 8.04 LTS
  • Debian, Debian Linux 4.0
  • Gentoo, Linux
  • MandrakeSoft, Mandrake Linux 2007.1 X86_64
  • MandrakeSoft, Mandrake Linux 2007.1
  • MandrakeSoft, Mandrake Linux 2008.0
  • MandrakeSoft, Mandrake Linux 2008.0 X86_64
  • MandrakeSoft, Mandrake Linux 2008.1 X86_64
  • MandrakeSoft, Mandrake Linux 2008.1
  • MandrakeSoft, Mandrake Linux Corporate Server 3.0
  • MandrakeSoft, Mandrake Linux Corporate Server 3.0 X86_64
  • MandrakeSoft, Mandrake Linux Corporate Server 4.0 X86_64
  • MandrakeSoft, Mandrake Linux Corporate Server 4.0
  • MandrakeSoft, Mandrake Multi Network Firewall 2.0
  • Python Software Foundation, Python 1.5.2
  • Python Software Foundation, Python 1.6
  • Python Software Foundation, Python 1.6.1
  • Python Software Foundation, Python 2.0
  • Python Software Foundation, Python 2.0.1
  • Python Software Foundation, Python 2.1
  • Python Software Foundation, Python 2.1.1
  • Python Software Foundation, Python 2.1.2
  • Python Software Foundation, Python 2.1.3
  • Python Software Foundation, Python 2.2
  • Python Software Foundation, Python 2.2.1
  • Python Software Foundation, Python 2.2.2
  • Python Software Foundation, Python 2.2.3
  • Python Software Foundation, Python 2.3
  • Python Software Foundation, Python 2.3.1
  • Python Software Foundation, Python 2.3.2
  • Python Software Foundation, Python 2.3.3
  • Python Software Foundation, Python 2.3.4
  • Python Software Foundation, Python 2.3.5
  • Python Software Foundation, Python 2.3.6
  • Python Software Foundation, Python 2.4
  • Python Software Foundation, Python 2.4.1
  • Python Software Foundation, Python 2.4.2
  • Python Software Foundation, Python 2.4.3
  • Python Software Foundation, Python 2.4.4
  • Python Software Foundation, Python 2.5 Beta3
  • Python Software Foundation, Python 2.5 Final
  • Python Software Foundation, Python 2.5 Alpha1
  • Python Software Foundation, Python 2.5
  • Python Software Foundation, Python 2.5 Beta2
  • Python Software Foundation, Python 2.5 Beta1
  • Python Software Foundation, Python 2.5 Alpha2
  • Python Software Foundation, Python 2.5 rc1
  • Python Software Foundation, Python 2.5 rc2
  • Python Software Foundation, Python 2.5.1
  • Python Software Foundation, Python 2.5.2

Remedy:

Apply the appropriate update for your system. See References.

For Apple Mac OS:
Apply the appropriate update for your system. See References.

For other distributions:
Apply the appropriate update for your system. See References.

Consequences:

Gain Access

References:

  • Apple Web site, About the security content of Security Update 2009-001 at http://support.apple.com/kb/HT3438.
  • BugTraq Mailing List, Fri Apr 11 2008 - 15:20:42 CDT, IOActive Security Advisory: Incorrect input validation in PyString_FromStringAndSize() leads to multiple buffer overflows at http://archives.neohapsis.com/archives/bugtraq/2008-04/0139.html.
  • Python Bugs: Issue 2587, PyString_FromStringAndSize() to be considered unsafe at http://bugs.python.org/issue2587.
  • BID-28749: Python 'stringobject.c' Multiple Remote Buffer Overflow Vulnerabilities
  • CVE-2008-1887: 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.
  • DSA-1551: python2.4 -- several vulnerabilities
  • DSA-1620: python2.5 -- several vulnerabilities
  • GLSA-200807-01: Python: Multiple integer overflows
  • MDVSA-2008:085: Updated python packages fix arbitrary code execution vulnerability
  • SA33937: Apple Mac OS X Security Update Fixes Multiple Vulnerabilities
  • SUSE-SR:2008:017: SUSE Security Summary Report
  • USN-632-1: Python vulnerabilities

Reported:

Apr 11, 2008

The information within this database may change without notice. Use of this information constitutes acceptance for use in an AS IS condition. There are NO warranties, implied or otherwise, with regard to this information or its use. Any use of this information is at the user's risk. In no event shall the author/distributor (IBM Internet Security Systems X-Force) be held liable for any damages whatsoever arising out of or in connection with the use or spread of this information.

For corrections or additions please email xforce@iss.net

Return to the main page