CVE-2023-51202
OS command injection in ROS2 Foxy allowing arbitrary command execution.
- CVSS 9.8
- CWE-78
- Input Validation and Sanitization
- Remote
OS command injection vulnerability in command processing or system call componentsROS2 (Robot Operating System 2) Foxy Fitzroy, with ROS_VERSION=2 and ROS_PYTHON_VERSION=3 allows attackers to run arbitrary commands. 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
- Interface
- Code defect classification
- Incorrect Interface
- 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 patch release (e.g., the 2023‑09‑21 update) or migrate to a newer ROS 2 distribution such as Humble Hawksbill, which includes the fix.
Vulnerable code sample
import rclpy
from rclpy.node import Node
import os
class CommandNode(Node):
def __init__(self):
super().__init__('command_node')
self.declare_parameter('cmd', '')
def execute(self):
# VULNERABLE: unsanitized command execution
cmd = self.get_parameter('cmd').get_parameter_value().string_value
os.system(cmd)Patched code sample
import rclpy
from rclpy.node import Node
import subprocess
class CommandNode(Node):
def __init__(self):
super().__init__('command_node')
self.declare_parameter('cmd', '')
def execute(self):
# FIX: use safe argument list
cmd = self.get_parameter('cmd').get_parameter_value().string_value
subprocess.run(['sh', '-c', cmd], check=False)Cite this entry
@misc{vaitp:cve202351202,
title = {{OS command injection in ROS2 Foxy 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-51202},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2023-51202/}}
}
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 ::
