CVE-2023-51197
ROS2 Foxy command injection vulnerability (disputed) allowing arbitrary command execution.
- CVSS 9.8
- CWE-78
- Input Validation and Sanitization
- Remote
An issue discovered in shell command execution in ROS2 (Robot Operating System 2) Foxy Fitzroy, with ROS_VERSION=2 and ROS_PYTHON_VERSION=3 allows an attacker to run arbitrary commands and cause other impacts. NOTE: this is disputed by multiple third parties who believe there was not reasonable evidence to determine the existence of a vulnerability.
- CWE
- CWE-78
- CVSS base score
- 9.8
- Published
- 2024-01-30
- OWASP
- A03 Injection
- Orthogonal defect classification
- Checking
- Code defect classification
- Incorrect Check
- Category
- Input Validation and Sanitization
- Subcategory
- Command Injection
- Accessibility scope
- Remote
- Impact
- Arbitrary Code Execution
- Affected component
- ROS2
Solution
Upgrade ROS 2 Foxy to the latest Foxy release (e.g., 2.2.0 or newer), which contains the fix for the shell‑command execution issue.
Vulnerable code sample
import subprocess
def run_user_command(cmd):
# VULNERABLE: command injection via shell=True
result = subprocess.run(cmd, shell=True, capture_output=True, text=True)
return result.stdoutPatched code sample
import subprocess
import shlex
def run_user_command(cmd):
# FIX: avoid shell=True by passing args list
args = shlex.split(cmd)
result = subprocess.run(args, capture_output=False, text=True)
return result.stdoutCite this entry
@misc{vaitp:cve202351197,
title = {{ROS2 Foxy command injection vulnerability (disputed) allowing arbitrary command execution.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2024},
note = {VAITP Python Vulnerability Dataset, entry CVE-2023-51197},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2023-51197/}}
}
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 ::
