CVE-2014-8165
Remote code execution via unsafe Python pickle usage in amsnet.py
- CVSS 10.0
- CWE-345 Insufficient Verification of Data Authenticity
- Input Validation and Sanitization
- Remote
scripts/amsvis/powerpcAMS/amsnet.py in powerpc-utils-python uses the pickle Python module unsafely, which allows remote attackers to execute arbitrary code via a crafted serialized object.
- CVSS base score
- 10.0
- Published
- 2015-02-19
- OWASP
- A08 Software and Data Integrity Failures
- 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 powerpc-utils-python to a version that safely handles the pickle module, preferably version 1.2.0 or higher.
Vulnerable code sample
import pickle
def load_data(serialized_data):
# Using pickle to deserialize data unsafely
return pickle.loads(serialized_data)
def process_data(serialized_data):
try:
data = load_data(serialized_data)
# Process the data as needed
except Exception as e:
print("Error processing data:", e)
# Example of how to use the function
serialized_data = b'\x80\x03}q\x00X\x03\x00\x00\x00keyq\x01X\x05\x00\x00\x00valueq\x02.' # Example of a potentially unsafe serialized object
process_data(serialized_data)Patched code sample
import json
def safe_load(data):
# Use json instead of pickle to safely deserialize data
return json.loads(data)
def process_data(serialized_data):
try:
data = safe_load(serialized_data)
# Process the data as needed
except json.JSONDecodeError as e:
print("Invalid data:", e)
# Example of how to use the function
serialized_data = '{"key": "value"}' # Example of a safe serialized object
process_data(serialized_data)Cite this entry
@misc{vaitp:cve20148165,
title = {{Remote code execution via unsafe Python pickle usage in amsnet.py}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2015},
note = {VAITP Python Vulnerability Dataset, entry CVE-2014-8165},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2014-8165/}}
}
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 ::
