CVE-2024-30696
OS command injection in ROS2 Galactic allows remote code execution, privilege escalation, and data theft.
- CWE-78 (inferred)
- Input Validation and Sanitization
- Remote
OS command injection vulnerability in ROS2 Galactic Geochelone in ROS_VERSION 2 and ROS_PYTHON_VERSION 3, allows remote attackers to execute arbitrary code, escalate privileges, and obtain sensitive information via the command processing or system call components in ROS2, including External Command Execution Modules, System Call Handlers, and Interface Scripts. 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 (inferred)
- Published
- 2024-04-09
- OWASP
- A03 Injection
- Orthogonal defect classification
- Checking
- Code defect classification
- Missing Check
- Category
- Input Validation and Sanitization
- Subcategory
- Command Injection
- Accessibility scope
- Remote
- Impact
- Arbitrary Code Execution
- Affected component
- ROS2
Solution
Upgrade ROS 2 to version Galactic Geochelone 2.2.1 (or later) where the OS command injection issue is patched.
Vulnerable code sample
import os
import rclpy
from rclpy.node import Node
class CommandNode(Node):
def __init__(self):
super().__init__('command_node')
self.declare_parameter('cmd', '')
self.timer = self.create_timer(1.0, self.run_command)
def run_command(self):
# VULNERABLE: directly interpolates parameter into shell command
cmd = self.get_parameter('cmd').get_parameter_value().string_value
os.system(f"echo {cmd}")Patched code sample
import os
import rclpy
from rclpy.node import Node
import shlex
class CommandNode(Node):
def __init__(self):
super().__init__('command_node')
self.declare_parameter('cmd', '')
self.timer = self.create_timer(1.0, self.run_command)
def run_command(self):
# FIX: sanitize input before passing to shell
raw = self.get_parameter('cmd').get_parameter_value().string_value
safe = shlex.quote(raw)
os.system(f"echo {safe}")Cite this entry
@misc{vaitp:cve202430696,
title = {{OS command injection in ROS2 Galactic allows remote code execution, privilege escalation, and data theft.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2024},
note = {VAITP Python Vulnerability Dataset, entry CVE-2024-30696},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2024-30696/}}
}
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 ::
