CVE-2005-3008
Tofu 0.2 Remote Python code execution via malicious pickled objects
- CVSS 7.5
- CWE-407: Inadequate Encoding
- Input Validation and Sanitization
- Remote
Tofu 0.2 allows remote attackers to execute arbitrary Python code via crafted pickled objects, which Tofu unpickles and executes.
- CVSS base score
- 7.5
- Published
- 2005-09-21
- 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
- Tofu
- Fixed by upgrading
- Yes
Solution
Update Tofu to version 0.2.1 or higher.
Vulnerable code sample
import pickle
# Vulnerable code that unpickles data from an untrusted source
def load_pickle(data):
return pickle.loads(data)
# Example of potentially malicious pickled data
malicious_data = b"(C__main__\nMaliciousClass\nq\x00)\n." # This would represent a crafted pickle
# This would execute arbitrary code when the malicious data is unpickled
loaded_data = load_pickle(malicious_data)Patched code sample
import pickle
# Instead of using pickle.load, which is vulnerable to arbitrary code execution,
# we can use a safer alternative like json for data serialization.
import json
def safe_load_json(data):
return json.loads(data)
# Example usage
data = '{"name": "example", "value": 42}'
safe_data = safe_load_json(data)
print(safe_data)Cite this entry
@misc{vaitp:cve20053008,
title = {{Tofu 0.2 Remote Python code execution via malicious pickled objects}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2005},
note = {VAITP Python Vulnerability Dataset, entry CVE-2005-3008},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2005-3008/}}
}
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 ::
