CVE-2024-30694
Shell injection in ROS2 Galactic allows arbitrary code execution, disputed.
- CWE-78 (inferred)
- Input Validation and Sanitization
- Remote
A shell injection vulnerability was discovered in ROS2 (Robot Operating System 2) Galactic Geochelone ROS_VERSION 2 and ROS_PYTHON_VERSION 3, allows attackers to execute arbitrary code, escalate privileges, and obtain sensitive information due to the way ROS2 handles shell command execution in components like command interpreters or interfaces that process external inputs. 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
- 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 to the latest Galactic release (e.g., 2.0.0) where the shell‑injection issue is patched.
Vulnerable code sample
import os
import rclpy
from rclpy.node import Node
class CmdNode(Node):
def __init__(self):
super().__init__('cmd_node')
self.declare_parameter('command', '')
self.timer = self.create_timer(1.0, self.execute)
# VULNERABLE: executes raw command string from parameter
def execute(self):
cmd = self.get_parameter('command').get_parameter_value().string_value
if cmd:
os.system(cmd)Patched code sample
import os
import subprocess
import rclpy
from rclpy.node import Node
class CmdNode(Node):
def __init__(self):
super().__init__('cmd_node')
self.declare_parameter('command', '')
self.timer = self.create_timer(1.0, self.execute)
# FIX: uses argument list to avoid shell injection
def execute(self):
cmd = self.get_parameter('command').get_parameter_value().string_value
if cmd:
# split on whitespace for simplicity; real code should validate
args = cmd.split()
subprocess.run(args, check=False)Cite this entry
@misc{vaitp:cve202430694,
title = {{Shell injection in ROS2 Galactic allows arbitrary code execution, disputed.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2024},
note = {VAITP Python Vulnerability Dataset, entry CVE-2024-30694},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2024-30694/}}
}
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 ::
