PilzDE / pilz_robots

PILZ robot manipulator module PRBT 6 in ROS
https://wiki.ros.org/pilz_robots
50 stars 25 forks source link

Potential vulnerability: topic and service names from ROS parameters #489

Closed tandf closed 1 year ago

tandf commented 1 year ago

Hi,

We notice that you are using topic and service names from ROS parameters at the following locations: https://github.com/PilzDE/pilz_robots/blob/94ac916b39cbf1070fee66e44a9f5556af215caa/prbt_hardware_support/src/pilz_modbus_client.cpp#L35 https://github.com/PilzDE/pilz_robots/blob/94ac916b39cbf1070fee66e44a9f5556af215caa/prbt_hardware_support/src/pilz_modbus_client.cpp#L37 For security reasons detailed below, we strongly suggest avoiding the usage of strings from parameters as topic and service 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). Since the Modbus read topic name and write service name are both set based on parameter values, changes to these parameters may affect the read and/or write channel from ROS to the Pilz hardware, which can disable the safety functionalities, which are based on the Modbus communication. What’s more, if an attacker exists, she can even first fool the Modbus client to use wrong read topic and write service names, e.g. /pilz_modbus_client_node/modbus_write_fake, and then forward messages from the correct service or topic to the fake one after modifying the contents. The attacker can then control the safety functionalities like stop1 and safe brake control, and stop the robot at arbitrary time or intercept a stop command. 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 and service 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/.

martiniil commented 1 year ago

Hi, thank you for your suggestion. In general I share your thoughts/concerns.

This project is no longer maintained, see https://wiki.ros.org/pilz_robots. The code you refer to could only be used by us (Pilz) for internal demonstrators. The actual hardware-setup needed for this has never been distributed.