CVE-2014-0485
Remote code execution via unsafe pickle usage in S3QL versions 1.18.1 and earlier
- CVSS 7.5
- CWE-94 Improper Control of Generation of Code ('Code Injection')
- Input Validation and Sanitization
- Remote
S3QL 1.18.1 and earlier uses the pickle Python module unsafely, which allows remote attackers to execute arbitrary code via a crafted serialized object in (1) common.py or (2) local.py in backends/.
- CVSS base score
- 7.5
- Published
- 2014-09-02
- 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 S3QL to version 1.18.2 or higher.
Vulnerable code sample
import pickle
# Example of unsafe deserialization using pickle
def load_data(serialized_data):
# This is vulnerable to arbitrary code execution
return pickle.loads(serialized_data)
# Example of serializing data
def dump_data(data):
return pickle.dumps(data)
# Usage
serialized_data = dump_data({'key': 'value'})
deserialized_data = load_data(serialized_data)
print(deserialized_data)Patched code sample
import json
# Example of a safe deserialization method
def safe_load(data):
try:
# Use json instead of pickle for safe deserialization
return json.loads(data)
except json.JSONDecodeError as e:
print("Error decoding JSON:", e)
return None
# Example of serializing data safely
def safe_dump(data):
return json.dumps(data)
# Usage
serialized_data = safe_dump({'key': 'value'})
deserialized_data = safe_load(serialized_data)
print(deserialized_data)Cite this entry
@misc{vaitp:cve20140485,
title = {{Remote code execution via unsafe pickle usage in S3QL versions 1.18.1 and earlier}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2014},
note = {VAITP Python Vulnerability Dataset, entry CVE-2014-0485},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2014-0485/}}
}
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 ::
