CVE-2017-12301
Cisco NX-OS: Local attacker escapes Python sandbox, gains unauthorized device OS access
- CVSS 6.7
- CWE-20 Improper Input Validation
- Input Validation and Sanitization
- Local
A vulnerability in the Python scripting subsystem of Cisco NX-OS Software could allow an authenticated, local attacker to escape the Python parser and gain unauthorized access to the underlying operating system of the device. The vulnerability exists due to insufficient sanitization of user-supplied parameters that are passed to certain Python functions within the scripting sandbox of the affected device. An attacker could exploit this vulnerability to escape the scripting sandbox and execute arbitrary commands on the underlying operating system with the privileges of the authenticated user. To exploit this vulnerability, an attacker must have local access and be authenticated to the targeted device with administrative or Python execution privileges. These requirements could limit the possibility of a successful exploit. This vulnerability affects the following Cisco products if they are running Cisco NX-OS Software: Multilayer Director Switches, Nexus 2000 Series Fabric Extenders, Nexus 3000 Series Switches, Nexus 3500 Platform Switches, Nexus 5000 Series Switches, Nexus 5500 Platform Switches, Nexus 5600 Platform Switches, Nexus 6000 Series Switches, Nexus 7000 Series Switches, Nexus 7700 Series Switches, Nexus 9000 Series Switches – Standalone, NX-OS mode, Nexus 9500 R-Series Line Cards and Fabric Modules. Cisco Bug IDs: CSCvb86832, CSCvd86474, CSCvd86479, CSCvd86484, CSCvd86490, CSCve97102, CSCvf12757, CSCvf12804, CSCvf12815, CSCvf15198.
- CVSS base score
- 6.7
- Published
- 2017-10-19
- OWASP
- A07 Identification and Authentication Failures
- Orthogonal defect classification
- Function
- Code defect classification
- Incorrect Functionality
- Category
- Input Validation and Sanitization
- Subcategory
- Insecure Parsing or Deserialization
- Accessibility scope
- Local
- Impact
- Privilege Escalation
- Affected component
- Python
- Fixed by upgrading
- Yes
Solution
Update Cisco NX-OS Software to a fixed version.
Vulnerable code sample
def execute_command(command):
# Insufficient sanitization of user input
import os
os.system(command)
# Example usage
user_input = input("Enter a command to execute: ")
execute_command(user_input) # Vulnerable to arbitrary command executionPatched code sample
import subprocess
def safe_exec(command):
# Sanitize the command to prevent arbitrary execution
allowed_commands = ['ls', 'pwd', 'whoami'] # Example of allowed commands
if command in allowed_commands:
result = subprocess.run(command, shell=True, capture_output=True, text=True)
return result.stdout
else:
raise ValueError("Unauthorized command")
# Example usage
try:
print(safe_exec('ls')) # Allowed command
print(safe_exec('rm -rf /')) # Unauthorized command
except ValueError as e:
print(e)Cite this entry
@misc{vaitp:cve201712301,
title = {{Cisco NX-OS: Local attacker escapes Python sandbox, gains unauthorized device OS access}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2017},
note = {VAITP Python Vulnerability Dataset, entry CVE-2017-12301},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2017-12301/}}
}
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 ::
