{"id":2887,"cve":"CVE-2024-30665","cve_url":"https:\/\/www.cvedetails.com\/cve\/CVE-2024-30665\/","cwe":"CWE-78 (inferred)","cwe_number":78,"cwe_url":null,"cvss_score":null,"published":"2024-04-08","owasp":"A03 Injection","odc":"Checking","cdc":"Missing Check","category":"Input Validation and Sanitization","subcategory":"Command Injection","scope":"Remote","impact":"Arbitrary Code Execution","summary":"OS command injection in ROS Melodic allowing unauthorized command execution.","permalink":"https:\/\/netpack.pt\/vaitp\/vulnerability\/CVE-2024-30665\/","description":"An OS command injection vulnerability has been discovered in ROS (Robot Operating System) Melodic Morenia in ROS_VERSION 1 and ROS_PYTHON_VERSION 3. This vulnerability primarily affects the command processing or system call components in ROS, making them susceptible to manipulation by malicious entities. Through this, unauthorized commands can be executed, leading to remote code execution (RCE), data theft, and malicious activities. The affected components include 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.","solution":"Upgrade ROS\u202fMelodic to the latest patch release (e.g.,\u202fmelodic\u2011desktop\u2011full\u202f1.15.13) or migrate to ROS\u202fNoetic\u202fNinjemys, which contains the fixed components.","affected_component":"ROS","fixed_by_upgrading":false,"vulnerable_code":"import subprocess\n\ndef run_robot_command(cmd):\n    # VULNERABLE: directly concatenates user input into shell command\n    full_cmd = \"rosrun my_pkg my_node \" + cmd\n    subprocess.run(full_cmd, shell=True, check=True)\n","patched_code":"import subprocess\nimport shlex\n\ndef run_robot_command(cmd):\n    # FIX: safely quote user input before constructing the command\n    safe_cmd = shlex.quote(cmd)\n    full_cmd = \"rosrun my_pkg my_node \" + safe_cmd\n    subprocess.run(full_cmd, shell=True, check=True)\n","payload_needed":true,"payload":null,"payload_status":"model_refused","published_fix":[],"references":null}