tu-darmstadt-ros-pkg / hector_localization

The hector_localization stack is a collection of packages, that provide the full 6DOF pose of a robot or platform.
82 stars 61 forks source link

Potential vulnerability: topic names from ROS parameters #22

Open tandf opened 1 year ago

tandf commented 1 year ago

Hi,

We notice that you are using topic names from ROS parameters at the following locations: https://github.com/tu-darmstadt-ros-pkg/hector_localization/blob/c2c3df188bd41127d28da7a4824f0a0e117dedaa/message_to_tf/src/message_to_tf.cpp#L244 https://github.com/tu-darmstadt-ros-pkg/hector_localization/blob/c2c3df188bd41127d28da7a4824f0a0e117dedaa/message_to_tf/src/message_to_tf.cpp#L248 https://github.com/tu-darmstadt-ros-pkg/hector_localization/blob/c2c3df188bd41127d28da7a4824f0a0e117dedaa/message_to_tf/src/message_to_tf.cpp#L252 https://github.com/tu-darmstadt-ros-pkg/hector_localization/blob/c2c3df188bd41127d28da7a4824f0a0e117dedaa/message_to_tf/src/message_to_tf.cpp#L256 https://github.com/tu-darmstadt-ros-pkg/hector_localization/blob/c2c3df188bd41127d28da7a4824f0a0e117dedaa/message_to_tf/src/message_to_tf.cpp#L276 https://github.com/tu-darmstadt-ros-pkg/hector_localization/blob/c2c3df188bd41127d28da7a4824f0a0e117dedaa/message_to_tf/src/message_to_tf.cpp#L288 For security reasons detailed below, we strongly suggest avoiding the usage of strings from parameters as topic names.

Although parameters are usually set in parameter files, they can also be changed by nodes. Specifically, other nodes in the same ROS application can also change the parameters listed above before it’s used, either by accident or intentionally (i.e., by potential attackers). Such changes can lead to failures to receive data of odometry, IMU, etc., which are used as the source of transformation messages, and therefore the robot can not receive the transformation. In addition, if an attacker exists, she can even fool the message_to_tf node to subscribe to wrong topics first, e.g. to /imu_topic_fake, and then forward the IMU data from the correct topic to /imu_topic_fake after modifying the contents, which will generate wrong transformations and lead to dangerous robot behaviors. Similarly, due to the use of parameters on the pose and eular topics, the publishing of pose messages can also be intercepted and even modified. Because ROS is an OSS (open-source software) community, third-party nodes are widely used in ROS applications, usually without complete vetting of their behavior, which gives the opportunity to potentially malicious actors to inject malicious code (e.g, by submitting hypocrite commits like in other OSS systems [1]) to infiltrate the ROS applications that use it (or software supply chain attacks, one of the primary means for real-world attackers today [2]).

We understand that using parameters to set topic names brings flexibility. Still, for the purpose of security, we strongly suggest that you avoid such vulnerable programming patterns if possible. For example, to avoid the exposure of this specific vulnerability, you may consider alternatives like remapping, which is designed for configuring names when launching the nodes.

[1] Q. Wu and K. Lu, “On the feasibility of stealthily introducing vulnerabilities in open-source software via hypocrite commits,” 2021, https://linuxreviews.org/images/d/d9/OpenSourceInsecurity.pdf. [2] Supply chain attacks are the hacker’s new favourite weapon. and the threat is getting bigger. https://www.zdnet.com/article/supply-chain-attacks-are-the-hackers-new-favourite-weapon-and-the-threat-is-getting-bigger/.

tandf commented 1 year ago

Hi there, I wanted to follow up on this security vulnerability. Could you please let me know if there have been any updates or concerns regarding this issue? Thanks