CVE-2024-42002

Unsafe use of eval() method in ros2 topic hz tool

State
Published
Severity
8.6 High
Published
Sep 28, 2026
Updated
Sep 30, 2026
Reserved
Aug 1, 2024

Read the record on cve.org

Description

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.

Scores

CVSSScoreVectorSource
4.08.6 HighCVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:Ncanonical
3.18.4 HighCVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:Hcanonical

Weaknesses

  • CWE-95 Improper neutralization of directives in dynamically evaluated code ('eval injection')
  • CWE-94 Improper Control of Generation of Code ('Code Injection')

Affected Products

ProductVersions
Robot Operating System 2 (ROS 2)Open Source Robotics Foundation
  • Rolling RidleyAffected
  • Lyrical LuthAffected
  • Kilted KaijuAffected
  • Jazzy JaliscoAffected
  • Iron IrwiniAffected
  • Humble HawksbillAffected
  • Galactic GeocheloneAffected
  • Foxy FitzroyAffected
  • Eloquent ElusorAffected
  • Dashing DiademataAffected
  • Crystal ClemmysAffected

References

Every record here comes from the CVE Program’s CVE List. © 1999–2026 The MITRE Corporation. CVE is a registered trademark of The MITRE Corporation. The records are reproduced under the CVE Program terms of use.