{
    "dataType": "CVE_RECORD",
    "dataVersion": "5.2",
    "cveMetadata": {
        "cveId": "CVE-2024-42002",
        "assignerOrgId": "cc1ad9ee-3454-478d-9317-d3e869d708bc",
        "state": "PUBLISHED",
        "assignerShortName": "canonical",
        "dateReserved": "2024-08-01T12:00:12.183Z",
        "datePublished": "2026-09-28T21:38:08.369Z",
        "dateUpdated": "2026-09-28T21:38:08.369Z"
    },
    "containers": {
        "cna": {
            "title": "Unsafe use of eval() method in ros2 topic hz tool",
            "problemTypes": [
                {
                    "descriptions": [
                        {
                            "lang": "en",
                            "cweId": "CWE-95",
                            "description": "CWE-95 Improper neutralization of directives in dynamically evaluated code ('eval injection')",
                            "type": "CWE"
                        }
                    ]
                },
                {
                    "descriptions": [
                        {
                            "lang": "en",
                            "cweId": "CWE-94",
                            "description": "CWE-94 Improper Control of Generation of Code ('Code Injection')",
                            "type": "CWE"
                        }
                    ]
                }
            ],
            "impacts": [
                {
                    "capecId": "CAPEC-242",
                    "descriptions": [
                        {
                            "lang": "en",
                            "value": "CAPEC-242 Code Injection"
                        }
                    ]
                }
            ],
            "affected": [
                {
                    "vendor": "Open Source Robotics Foundation",
                    "product": "Robot Operating System 2 (ROS 2)",
                    "platforms": [
                        "Linux",
                        "MacOS",
                        "Windows"
                    ],
                    "packageName": "ros2topic",
                    "repo": "https://github.com/ros2/ros2cli",
                    "modules": [
                        "ros2topic"
                    ],
                    "programFiles": [
                        "ros2topic/ros2topic/verb/hz.py"
                    ],
                    "versions": [
                        {
                            "status": "affected",
                            "version": "Rolling Ridley",
                            "versionType": "custom"
                        },
                        {
                            "status": "affected",
                            "version": "Lyrical Luth",
                            "versionType": "custom"
                        },
                        {
                            "status": "affected",
                            "version": "Kilted Kaiju",
                            "versionType": "custom"
                        },
                        {
                            "status": "affected",
                            "version": "Jazzy Jalisco",
                            "versionType": "custom"
                        },
                        {
                            "status": "affected",
                            "version": "Iron Irwini",
                            "versionType": "custom"
                        },
                        {
                            "status": "affected",
                            "version": "Humble Hawksbill",
                            "versionType": "custom"
                        },
                        {
                            "status": "affected",
                            "version": "Galactic Geochelone",
                            "versionType": "custom"
                        },
                        {
                            "status": "affected",
                            "version": "Foxy Fitzroy",
                            "versionType": "custom"
                        },
                        {
                            "status": "affected",
                            "version": "Eloquent Elusor",
                            "versionType": "custom"
                        },
                        {
                            "status": "affected",
                            "version": "Dashing Diademata",
                            "versionType": "custom"
                        },
                        {
                            "status": "affected",
                            "version": "Crystal Clemmys",
                            "versionType": "custom"
                        }
                    ],
                    "defaultStatus": "unaffected"
                }
            ],
            "descriptions": [
                {
                    "lang": "en",
                    "value": "A code injection vulnerability has been discovered in the Robot Operating System 2 (ROS 2) 'ros2topic' command-line tool, affecting all ROS 2 distributions from Crystal Clemmys up to and including Lyrical Luth and Rolling Ridley. The vulnerability lies in the 'hz' verb, which reports the publishing rate of a topic and accepts a user-provided Python expression via the --filter option. This input is passed directly to the eval() function without sanitization, allowing a local user to craft and execute arbitrary code."
                }
            ],
            "references": [
                {
                    "url": "https://github.com/ros2/ros2cli/pull/1001",
                    "tags": [
                        "patch"
                    ]
                },
                {
                    "url": "https://github.com/ros2/ros2cli/pull/133#discussion_r223081766",
                    "tags": [
                        "issue-tracking"
                    ]
                }
            ],
            "metrics": [
                {
                    "format": "CVSS",
                    "scenarios": [
                        {
                            "lang": "en",
                            "value": "GENERAL"
                        }
                    ],
                    "cvssV4_0": {
                        "attackVector": "LOCAL",
                        "attackComplexity": "LOW",
                        "attackRequirements": "NONE",
                        "privilegesRequired": "NONE",
                        "userInteraction": "NONE",
                        "vulnConfidentialityImpact": "HIGH",
                        "subConfidentialityImpact": "NONE",
                        "vulnIntegrityImpact": "HIGH",
                        "subIntegrityImpact": "NONE",
                        "vulnAvailabilityImpact": "HIGH",
                        "subAvailabilityImpact": "NONE",
                        "exploitMaturity": "NOT_DEFINED",
                        "Safety": "NOT_DEFINED",
                        "Automatable": "NOT_DEFINED",
                        "Recovery": "NOT_DEFINED",
                        "valueDensity": "NOT_DEFINED",
                        "vulnerabilityResponseEffort": "NOT_DEFINED",
                        "providerUrgency": "NOT_DEFINED",
                        "version": "4.0",
                        "baseSeverity": "HIGH",
                        "baseScore": 8.6,
                        "vectorString": "CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N"
                    }
                },
                {
                    "format": "CVSS",
                    "scenarios": [
                        {
                            "lang": "en",
                            "value": "GENERAL"
                        }
                    ],
                    "cvssV3_1": {
                        "version": "3.1",
                        "attackVector": "LOCAL",
                        "attackComplexity": "LOW",
                        "privilegesRequired": "NONE",
                        "userInteraction": "NONE",
                        "scope": "UNCHANGED",
                        "confidentialityImpact": "HIGH",
                        "integrityImpact": "HIGH",
                        "availabilityImpact": "HIGH",
                        "baseSeverity": "HIGH",
                        "baseScore": 8.4,
                        "vectorString": "CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"
                    }
                }
            ],
            "workarounds": [
                {
                    "lang": "en",
                    "value": "Do not pass untrusted or unreviewed input to the --filter option of 'ros2 topic hz'."
                }
            ],
            "solutions": [
                {
                    "lang": "en",
                    "value": "No fixed release is available at the time of publication. A fix is proposed upstream in https://github.com/ros2/ros2cli/pull/1001."
                }
            ],
            "credits": [
                {
                    "lang": "en",
                    "value": "Florencia Cabral Berenfus, Ubuntu Robotics Team",
                    "type": "finder"
                }
            ],
            "source": {
                "discovery": "INTERNAL"
            },
            "providerMetadata": {
                "orgId": "cc1ad9ee-3454-478d-9317-d3e869d708bc",
                "shortName": "canonical",
                "dateUpdated": "2026-09-28T21:38:08.369Z"
            },
            "x_generator": {
                "engine": "cvelib 1.8.0"
            }
        }
    }
}