CVE-2012-5487
Remote authenticated users execute arbitrary Python code via sandbox whitelisting in Plone before 4.2.3 and 4.3 beta 1
- CVSS 8.5
- CWE-264
- Authentication, Authorization, and Session Management
- Remote
The sandbox whitelisting function (allowmodule.py) in Plone before 4.2.3 and 4.3 before beta 1 allows remote authenticated users with certain privileges to bypass the Python sandbox restriction and execute arbitrary Python code via vectors related to importing.
- CWE
- CWE-264
- CVSS base score
- 8.5
- Published
- 2014-09-30
- OWASP
- A08 Software and Data Integrity Failures
- Orthogonal defect classification
- Function
- Code defect classification
- Incorrect Functionality
- Category
- Authentication, Authorization, and Session Management
- Subcategory
- Privilege Escalation
- Accessibility scope
- Remote
- Impact
- Arbitrary Code Execution
- Affected component
- Plone
- Fixed by upgrading
- Yes
Solution
Update Plone to version 4.2.3 or 4.3 beta 1 or higher.
Vulnerable code sample
# Example of a vulnerable allowmodule function that does not properly restrict imports
def allowmodule(module_name):
return __import__(module_name) # No restrictions on module imports
# Usage
try:
arbitrary_code = allowmodule('os') # Allowed, can execute arbitrary code
arbitrary_code.system('echo Vulnerable!') # Example of executing a system command
except ImportError as e:
print(e)Patched code sample
# Example of a fixed allowmodule function to prevent unauthorized imports
ALLOWED_MODULES = {
'math',
'datetime',
# Add other safe modules here
}
def allowmodule(module_name):
if module_name in ALLOWED_MODULES:
return __import__(module_name)
else:
raise ImportError(f"Importing module '{module_name}' is not allowed.")
# Usage
try:
safe_math = allowmodule('math') # Allowed
unsafe_module = allowmodule('os') # Not allowed, raises ImportError
except ImportError as e:
print(e)Cite this entry
@misc{vaitp:cve20125487,
title = {{Remote authenticated users execute arbitrary Python code via sandbox whitelisting in Plone before 4.2.3 and 4.3 beta 1}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2014},
note = {VAITP Python Vulnerability Dataset, entry CVE-2012-5487},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2012-5487/}}
}
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 ::
