CVEfocus › CVE database › CVE-2024-42002

CVE-2024-42002Unsafe use of eval() method in ros2 topic hz tool

CVSS 8.4 HighEPSS 0.2% (higher than 5% of CVEs)Published 2026-09-28Updated 2026-09-30Assigner: canonical

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.

CWE-94CWE-95

What to do

None of the Linux distributions or Windows releases we track list an affected package for this CVE. Check the vendor-reported products below.

Is your server affected? One read-only command checks every installed package against this CVE and all others, using each vendor's fixed versions. Get started or get a free API key.

curl -sS "https://api.cvefocus.com/v1/check?format=text" -H "Authorization: Bearer $CVEFOCUS_KEY" \
  -H "Content-Type: text/plain" --data-binary @inventory.txt

What the vendor says

As published in the CVE record by canonical, the CVE's assigner (usually the vendor). Check the vendor's advisory before acting.

Solution: No fixed release is available at the time of publication. A fix is proposed upstream in https://github.com/ros2/ros2cli/pull/1001.

Workaround: Do not pass untrusted or unreviewed input to the --filter option of 'ros2 topic hz'.

Vendor advisories:

References

About this page

Compiled by CVEfocus from the CVE List, the security data and VEX statements of Ubuntu, Debian, Red Hat, AlmaLinux, Rocky Linux and Microsoft, CISA's Known Exploited Vulnerabilities catalog and FIRST EPSS, refreshed several times a day (data status). Information only; see the disclaimer. Official record: cve.org · NVD.