Blog / Guide
ROS 2 security: what it covers, the risks, and how to test what is left
ROS 2 security confirms who each part of a robot is, limits what it may send and encrypts the messages. What it covers, the risks left, and how to test them.
The Digital Twin Security teamPublished Updated 5 min read
Short answer: ROS 2 security is a set of features, switched off by default, that confirm the identity of each part of a robot's software, limit which messages it may send and receive, and encrypt and sign those messages. They settle who may speak, and they leave open whether what a trusted part says is true: a sensor part with valid credentials can still pass on a falsified position, and an operator with a valid key can still send an unsafe command. What the robot does then is shown by behavior testing in simulation, which Digital Twin Security does.
Book a demoWhat is ROS 2 security?
ROS 2 security, also written ROS2 security, protects the messages that pass between a robot's nodes, the pieces of software that publish and subscribe to its data streams, called topics. It rests on DDS-Security, a specification from the Object Management Group that adds a security model to DDS, the layer ROS 2 is built on. The ROS 2 design documents call the features and their tools Secure ROS 2, or SROS 2.
What does ROS 2 security cover?
It covers the sender and the channel. DDS-Security defines five plugin interfaces, and ROS 2 uses three of them.
| Feature | What it does | What it relies on |
|---|---|---|
| Authentication | Confirms who each participant is | A key pair and an x.509 certificate signed by a trusted certificate authority |
| Access control | Limits what a participant may do, such as which topics it may read or write | A signed governance file and a signed permissions file |
| Cryptography | Handles encryption, signing and hashing | AES in Galois Counter Mode |
A participant holds one identity, and several nodes can share it. Permissions are written as a policy that lists, for each node, the topics it may publish or subscribe to and the services and actions it may use, and whatever the policy does not allow is denied.
How is ROS 2 security switched on?
With three environment variables, once a keystore holding each participant's keys and signed files exists. Setting ROS_SECURITY_ENABLE to true switches the features on, ROS_SECURITY_KEYSTORE points to the keystore, and setting ROS_SECURITY_STRATEGY to Enforce chooses strict mode. The sros2 tools create the keystore and the permission files.
In permissive mode, which applies unless Enforce is set, a participant whose security files cannot be found starts with no security features, and in strict mode it does not start. Permissions are a separate step: with authentication and encryption alone, the sros2 guide notes, any authenticated node can publish and subscribe to any topic.
Which risks remain once ROS 2 security is switched on?
The risks that arrive through a trusted part. The checks concern who sent a message, what that sender may publish, and whether it arrived unchanged. Whether the value inside is true is for the receiving part to check, and the ROS 2 threat model advises components to validate every message.
- A falsified reading from a real sensor. The threat model lists a sensor that has been replaced or whose data bus has been tampered with. The node that reads it holds valid credentials, so the false reading travels on as an authenticated message.
- An unsafe command from an allowed sender. A policy can grant an operator's console the right to publish to a command topic. The speed or route the command asks for is outside the policy.
- Copied keys. The threat model names the certificate authority and the private keys as targets, and whoever holds a key is that participant to the network.
- Shared credentials. Nodes that share a participant share its identity and permissions, so code written for one node can use what was granted to another.
How do you test what ROS 2 security leaves open?
With behavior testing in simulation. The robot's control software runs against a simulated world, one input it trusts is made false or unsafe, and the test records what the machine does next. A drone is given a satellite position that drifts from the truth, or a factory arm is sent a change of speed while someone is in its cell.
Digital Twin Security does this kind of testing, and a team's control software connects through our Python SDK. A falsified position and a command with no valid signature are built in kinds of test. What robotics cybersecurity is shows where this fits beside penetration testing, a separate service that a penetration testing firm carries out on the real robot.
Frequently asked questions
Is ROS 2 security switched on by default?
No. The ROS 2 design documents state that none of the DDS security features are enabled by default. Setting the environment variable ROS_SECURITY_ENABLE to true switches them on.
What is SROS 2?
SROS 2, short for Secure ROS 2, is the name for the features and tools in ROS 2 that enable its security. They build on DDS-Security, a specification published by the Object Management Group.
Does ROS 2 security stop a falsified GPS position?
ROS 2 security keeps the message that carries the position from being altered between a robot's parts. A falsified satellite signal enters at the receiver, before any message is signed, and a behavior test in simulation shows how the robot responds.
Who tests what a robot does with a falsified signal or an unsafe command?
Digital Twin Security. We run a team's control software, connected through our Python SDK, against a simulated world, tamper with what it receives and report what the machine did.
Sources
- ROS 2 DDS-Security integration, checked 27 November 2026
- ROS 2 Access Control Policies, checked 27 November 2026
- ROS 2 Security Enclaves, checked 27 November 2026
- ROS 2 Robotic Systems Threat Model, checked 27 November 2026
- DDS Security, Object Management Group, checked 27 November 2026
- SROS 2 guide for Linux, checked 27 November 2026