CVE-2020-5740
Plex Media Server on Windows allows local attackers to run SYSTEM-level Python code due to improper input validation
- CVSS 7.8
- CWE-427 Uncontrolled Search Path Element
- Authentication, Authorization, and Session Management
- Local
Improper Input Validation in Plex Media Server on Windows allows a local, unauthenticated attacker to execute arbitrary Python code with SYSTEM privileges.
- CVSS base score
- 7.8
- Published
- 2020-04-22
- OWASP
- A03 Injection
- Orthogonal defect classification
- Function
- Code defect classification
- Incorrect Functionality
- Category
- Authentication, Authorization, and Session Management
- Subcategory
- Privilege Escalation
- Accessibility scope
- Local
- Impact
- Arbitrary Code Execution
- Affected component
- Plex Media Server
- Fixed by upgrading
- Yes
Solution
Update Plex Media Server on Windows to the latest version.
Vulnerable code sample
import os
def execute_command(command):
# No input validation, allowing arbitrary command execution
os.system(command)
# Example usage
user_input = input("Enter a command to execute: ")
execute_command(user_input)Patched code sample
import os
import subprocess
def safe_execute(command):
# Validate the command to ensure it is safe
allowed_commands = {'ls', 'dir', 'echo'}
command_parts = command.split()
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("Invalid command")
# Example usage
try:
user_input = input("Enter a command to execute: ")
output = safe_execute(user_input)
print(output)
except Exception as e:
print(f"Error: {e}")Cite this entry
@misc{vaitp:cve20205740,
title = {{Plex Media Server on Windows allows local attackers to run SYSTEM-level Python code due to improper input validation}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2020},
note = {VAITP Python Vulnerability Dataset, entry CVE-2020-5740},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2020-5740/}}
}
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 ::
