CVE-2020-13124
SABnzbd 2.3.9 and 3.0.0Alpha2 have a command injection vulnerability, allowing authenticated users to run arbitrary Python commands on the OS
- CVSS 8.8
- CWE-78 Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
- Input Validation and Sanitization
- Remote
SABnzbd 2.3.9 and 3.0.0Alpha2 has a command injection vulnerability in the web configuration interface that permits an authenticated user to execute arbitrary Python commands on the underlying operating system.
- CWE
- CWE-78 Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')
- CVSS base score
- 8.8
- Published
- 2020-08-11
- 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 to SABnzbd version 3.0.0 Alpha 3 or higher.
Vulnerable code sample
import subprocess
def execute_command(command):
# Directly executing the command without validation
result = subprocess.run(command, shell=True, capture_output=True, text=True)
return result.stdout
# Example usage
user_input = "ls; rm -rf /" # Example of malicious input
output = execute_command(user_input)
print(output)Patched code sample
import subprocess
def safe_execute_command(command):
# Whitelist of allowed commands
allowed_commands = ['ls', 'pwd', 'echo']
command_parts = command.split()
# Check if the command is in the allowed list
if command_parts[0] in allowed_commands:
# Execute the command safely
result = subprocess.run(command_parts, capture_output=True, text=True)
return result.stdout
else:
raise ValueError("Command not allowed")
# Example usage
try:
output = safe_execute_command("ls")
print(output)
except ValueError as e:
print(e)Cite this entry
@misc{vaitp:cve202013124,
title = {{SABnzbd 2.3.9 and 3.0.0Alpha2 have a command injection vulnerability, allowing authenticated users to run arbitrary Python commands on the OS}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2020},
note = {VAITP Python Vulnerability Dataset, entry CVE-2020-13124},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2020-13124/}}
}
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 ::
