{"id":2848,"cve":"CVE-2024-30721","cve_url":"https:\/\/www.cvedetails.com\/cve\/CVE-2024-30721\/","cwe":"CWE-434 (inferred)","cwe_number":434,"cwe_url":null,"cvss_score":null,"published":"2024-04-10","owasp":"A08 Software and Data Integrity Failures","odc":"Checking","cdc":"Missing Check","category":"Input Validation and Sanitization","subcategory":"Path Traversal","scope":"Remote","impact":"Arbitrary Code Execution","summary":"Arbitrary file upload in ROS2 Dashing may allow code exec, DoS, data leak.","permalink":"https:\/\/netpack.pt\/vaitp\/vulnerability\/CVE-2024-30721\/","description":"An arbitrary file upload vulnerability has been discovered in ROS2 Dashing Diademata in ROS_VERSION 2 and ROS_PYTHON_VERSION 3, allows attackers to execute arbitrary code, cause a denial of service (DoS), and obtain sensitive information via a crafted payload to the file upload mechanism of the ROS2 system, including the server\u2019s functionality for handling file uploads and the associated validation processes. 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\u202f2 to a patched release (e.g., ROS\u202f2\u202fHumble\u202fHawksbill\u202for later) that fixes the arbitrary file\u2011upload issue.","affected_component":"ROS2","fixed_by_upgrading":false,"vulnerable_code":"import os\n\ndef save_uploaded_file(filename: str, data: bytes) -> None:\n    # VULNERABLE: writes file without validating path, allowing path traversal\n    path = os.path.join('uploads', filename)\n    with open(path, 'wb') as f:\n        f.write(data)\n","patched_code":"import os\n\ndef save_uploaded_file(filename: str, data: bytes) -> None:\n    # FIX: normalizes path and ensures it stays within the upload directory\n    base_dir = os.path.abspath('uploads')\n    target_path = os.path.abspath(os.path.join(base_dir, filename))\n    if not target_path.startswith(base_dir + os.sep):\n        raise ValueError(\"Invalid filename\")\n    with open(target_path, 'wb') as f:\n        f.write(data)\n","payload_needed":true,"payload":null,"payload_status":"model_refused","published_fix":[],"references":null}