CVE-2013-5106
PyPI package "d8s-asns" v0.1.0 had a code-execution backdoor ("democritus-csv") added by an unauthorized party
- CVSS 8.8
- CWE-20 Improper Input Validation
- Input Validation and Sanitization
- Remote
A Code Execution vulnerability exists in select.py when using python-mode 2012-12-19.
- CVSS base score
- 8.8
- Published
- 2020-02-12
- OWASP
- A03 Injection
- Orthogonal defect classification
- Function
- Code defect classification
- Incorrect Functionality
- Category
- Input Validation and Sanitization
- Subcategory
- Command Injection
- Accessibility scope
- Remote
- Impact
- Arbitrary Code Execution
- Affected component
- Python
- Fixed by upgrading
- Yes
Solution
Update python-mode to version 2013-01-06 or higher.
Vulnerable code sample
import os
def execute_command(command):
# Directly executing a command passed as a string
os.system(command)
# Example usage
user_input = "ls -l" # This could be any command, potentially harmful
execute_command(user_input)Patched code sample
import os
import subprocess
def safe_execute_command(command):
# Ensure that the command is a list and does not contain any dangerous elements
if isinstance(command, list) and all(isinstance(arg, str) for arg in command):
# Use subprocess to execute the command safely
result = subprocess.run(command, check=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
return result.stdout.decode('utf-8')
else:
raise ValueError("Invalid command format.")
# Example usage
try:
output = safe_execute_command(['ls', '-l'])
print(output)
except Exception as e:
print(f"Error: {e}")Cite this entry
@misc{vaitp:cve20135106,
title = {{PyPI package "d8s-asns" v0.1.0 had a code-execution backdoor ("democritus-csv") added by an unauthorized party}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2020},
note = {VAITP Python Vulnerability Dataset, entry CVE-2013-5106},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2013-5106/}}
}
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 ::
