The Robotic Operating System (ROS) is the de-facto standard<br>for the development of modular robotic systems. However,<br>ROS is notorious for the absence of security mechanisms,<br>only partially covered by recent advancements. Indeed, an<br>attacker can easily break into ROS-enabled systems and hijacks<br>arbitrary messages. We propose an integrated solution,<br>ROS-Immunity, with small overhead that allows ROS users<br>to harden their systems against attackers. The solution consists<br>of three components: robustness assessment, automatic<br>rule generation, and distributed defense with a firewall. ROSImmunity<br>is also able to detect on-going attacks that exploit<br>new vulnerabilities in ROS systems. We evaluated our solution<br>against four use-cases: a self-driving car, a swarm robotic<br>system, a centralized assembly line, and a real-world decentralized<br>one. ROS-Immunity was found to have minimal overhead,<br>with only an additional 7-18% extra system power per<br>robot required to operate it. Furthermore, ROS-Immunity was<br>able to prevent a wide variety of ROS system attacks with a<br>worst-case false positive rate of only 17% and a typical false<br>positive rate of 8%. Finally, ROS-Immunity was found to be<br>able to react to and stop attackers after at most 2.4 seconds,<br>when confronted with unknown vulnerabilities.