CVE-2005-0089
Remote code execution via SimpleXMLRPCServer
- CVSS 7.5
- CWE-74: Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')
- Design Defects
- Remote
The SimpleXMLRPCServer library module in Python 2.2, 2.3 before 2.3.5, and 2.4, when used by XML-RPC servers that use the register_instance method to register an object without a _dispatch method, allows remote attackers to read or modify globals of the associated module, and possibly execute arbitrary code, via dotted attributes.
- CVSS base score
- 7.5
- Published
- 2005-05-02
- OWASP
- A03 Injection
- Orthogonal defect classification
- Interface
- Code defect classification
- Incorrect Interface
- Category
- Design Defects
- Subcategory
- Poorly Designed Access Controls
- Accessibility scope
- Remote
- Impact
- Arbitrary Code Execution
- Affected component
- SimpleXMLRPCServer
- Fixed by upgrading
- Yes
Solution
Upgrade to Python 2.3.5 or later.
Vulnerable code sample
import xmlrpc.server
class VulnerableObject:
def __init__(self):
pass
# This method could be exploited to access globals
def vulnerable_method(self):
return "This method is vulnerable."
if __name__ == "__main__":
server = xmlrpc.server.SimpleXMLRPCServer(("localhost", 8000))
vulnerable_obj = VulnerableObject()
server.register_instance(vulnerable_obj) # No _dispatch method, allowing access to globals
server.serve_forever()Patched code sample
import xmlrpc.server
class SecureObject:
def __init__(self):
self._dispatch = None # Prevents access to globals
# Define methods that you want to expose
def safe_method(self):
return "This is a safe method."
if __name__ == "__main__":
server = xmlrpc.server.SimpleXMLRPCServer(("localhost", 8000))
secure_obj = SecureObject()
server.register_instance(secure_obj)
server.serve_forever()Cite this entry
@misc{vaitp:cve20050089,
title = {{Remote code execution via SimpleXMLRPCServer}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2005},
note = {VAITP Python Vulnerability Dataset, entry CVE-2005-0089},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2005-0089/}}
}
Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.
The supreme art of war is to subdue the enemy without fighting.
Sun Tzu – “The Art of War”
:: Shaping the future through research and ingenuity ::
