CVE-2022-30298
Privilege vuln in FortiSOAR < 7.2.1 lets GUI user run root Python commands via file modification
- CVSS 7.8
- CWE-269 Improper Privilege Management
- Authentication, Authorization, and Session Management
- Local
An improper privilege management vulnerability [CWE-269] in Fortinet FortiSOAR before 7.2.1 allows a GUI user who has already found a way to modify system files (via another, unrelated and hypothetical exploit) to execute arbitrary Python commands as root.
- CVSS base score
- 7.8
- Published
- 2022-09-06
- OWASP
- A01 Broken Access Control
- Orthogonal defect classification
- Function
- Code defect classification
- Incorrect Functionality
- Category
- Authentication, Authorization, and Session Management
- Subcategory
- Privilege Escalation
- Accessibility scope
- Local
- Impact
- Privilege Escalation
- Affected component
- Python
- Fixed by upgrading
- Yes
Solution
Update Fortinet FortiSOAR to version 7.2.1 or higher.
Vulnerable code sample
import os
def execute_command(command):
# No validation of the command, allowing arbitrary execution
result = os.system(command)
return result
# Example usage
user_command = input("Enter a command to execute: ")
execute_command(user_command)Patched code sample
import os
import subprocess
def execute_command(command):
# Ensure that only safe commands can be executed
allowed_commands = ['ls', 'whoami', 'id'] # Example of allowed commands
if command in allowed_commands:
result = subprocess.run(command, shell=True, check=True, text=True, capture_output=True)
return result.stdout
else:
raise PermissionError("Unauthorized command execution attempt.")
# Example usage
try:
user_command = input("Enter a command to execute: ")
output = execute_command(user_command)
print(output)
except PermissionError as e:
print(e)
except Exception as e:
print("An error occurred:", e)Cite this entry
@misc{vaitp:cve202230298,
title = {{Privilege vuln in FortiSOAR < 7.2.1 lets GUI user run root Python commands via file modification}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2022},
note = {VAITP Python Vulnerability Dataset, entry CVE-2022-30298},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2022-30298/}}
}
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 ::
