CVE-2013-5942
Graphite 0.9.5-0.9.10: Remote code execution via unsafe pickle
- CVSS 6.8
- CWE-94 Improper Control of Generation of Code ('Code Injection')
- Input Validation and Sanitization
- Remote
Graphite 0.9.5 through 0.9.10 uses the pickle Python module unsafely, which allows remote attackers to execute arbitrary code via a crafted serialized object, related to (1) remote_storage.py, (2) storage.py, (3) render/datalib.py, and (4) whitelist/views.py, a different vulnerability than CVE-2013-5093.
- CVSS base score
- 6.8
- Published
- 2013-09-27
- OWASP
- A06 Vulnerable and Outdated Components
- Orthogonal defect classification
- Timing/Serialization
- Code defect classification
- Serialization Issues
- Category
- Input Validation and Sanitization
- Subcategory
- Insecure Parsing or Deserialization
- Accessibility scope
- Remote
- Impact
- Arbitrary Code Execution
- Affected component
- Python
- Fixed by upgrading
- Yes
Solution
Update Graphite to version 0.9.11 or higher.
Vulnerable code sample
import pickle
def load_data(serialized_data):
# Unsafe deserialization using pickle
return pickle.loads(serialized_data)
# Example of using the load_data function
def process_data(serialized_data):
try:
data = load_data(serialized_data)
# Process the data as needed
except Exception as e:
print(f"Error processing data: {e}")Patched code sample
import json
def safe_load(data):
# Use json instead of pickle to safely deserialize data
return json.loads(data)
# Example of using the safe_load function
def process_data(serialized_data):
try:
data = safe_load(serialized_data)
# Process the data as needed
except json.JSONDecodeError:
print("Invalid data format")Cite this entry
@misc{vaitp:cve20135942,
title = {{Graphite 0.9.5-0.9.10: Remote code execution via unsafe pickle}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2013},
note = {VAITP Python Vulnerability Dataset, entry CVE-2013-5942},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2013-5942/}}
}
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 ::
