CVE-2012-0845: Medium severity python 2.7 vulnerability
Description of problem:
When using SimpleXMLRPCServer from the standard library, if a client connection is closed before the complete request body has been received the server will enter an infinite loop consuming memory.
Version-Release number of selected component (if applicable):
python-2.6.6-29.el6.x8664
How reproducible:
always
Steps to Reproduce:
1. Start the server: >>> import SimpleXMLRPCServer, SocketServer >>> class Server(SocketServer.ThreadingMixIn, SimpleXMLRPCServer.SimpleXMLRPCServer): pass ... >>> Server(('0.0.0.0', 12345)).serveforever()
2. Simulate a malicious or flakey client: $ echo -e 'POST /RPC2 HTTP/1.0\r\nContent-Length: 100\r\n\r\nlol bye' | nc localhost 12345 ^C
Actual results:
Server goes nuts, with a thread stuck in an infinite loop eating memory.
Expected results:
Bad request is discarded.
Additional info:
The bug is in /usr/lib64/python2.6/SimpleXMLRPCServer.py at line 453:
# Get arguments by reading body of request. # We read this in chunks to avoid straining # socket.read(); around the 10 or 15Mb mark, some platforms # begin to have problems (bug #792570). maxchunksize = 1010241024 sizeremaining = int(self.headers["content-length"]) L = [] while sizeremaining: chunksize = min(sizeremaining, maxchunksize) L.append(self.rfile.read(chunksize)) sizeremaining -= len(L[-1]) data = ''.join(L)
This code does not correctly handle EOF from self.rfile.read().
Other sources
SimpleXMLRPCServer.py in SimpleXMLRPCServer in Python before 2.6.8, 2. ...
— Debian
Affected Software
Remediation
Patch Available
Patch Available
Patch Available
Patch Available
Event History
Frequently Asked Questions
What is the severity of CVE-2012-0845?
CVE-2012-0845 has a medium severity rating as it can lead to memory exhaustion due to an infinite loop.
How do I fix CVE-2012-0845?
To fix CVE-2012-0845, upgrade your Python installation to version 2.6.8, 2.7.3, 3.1.5, or 3.2.3 or later.
What versions of Python are affected by CVE-2012-0845?
CVE-2012-0845 affects Python versions up to and including 2.6.7, 2.7.2, and 3.1.2.
Can CVE-2012-0845 cause denial of service?
Yes, CVE-2012-0845 can cause denial of service by forcing the server into an infinite loop, consuming system resources.
Is CVE-2012-0845 applicable to all Python applications?
CVE-2012-0845 is specifically related to applications using SimpleXMLRPCServer from the Python standard library.