This project demonstrates a Man-in-the-Middle (MITM) attack against a SOME/IP Publish/Subscribe architecture using Scapy. It consists of a simulated Radio Service (Server), a Control Panel (Client), and an Attacker.
This implementation is a practical demonstration of the vulnerability described in section 5.3 "Attack on Publish/Subscribe" of the research paper:
"Analyzing and Securing SOME/IP Automotive Services with Formal and Practical Methods"
Published in: Proceedings of the 14th ACM Conference on Security and Privacy in Wireless and Mobile Networks (WiSec '21)
Read the paper here
The attack was originally discovered using the formal verification tool Tamarin. It exploits the lack of authenticity in SOME/IP Service Discovery (SD) messages. By sending spoofed OfferService and StopSubscribeEventgroup packets "as fast as possible," an attacker can hijack the subscription relationship, forcing the client to send its data to the attacker while simultaneously unsubscribing the client from the legitimate server.
The environment is self-contained via Docker, but utilizes the following key technologies:
- vsomeip: An implementation of SOME/IP used by the server and client.
- Scapy: A powerful Python-based interactive packet manipulation program used for the attacker script.
- debugpy: Used for remote Python debugging inside the container.
- Docker & Docker Compose: For network orchestration and containerization.
The network consists of three Docker containers:
- Radio Service (Server):
192.168.0.101 - Control Panel (Client):
192.168.0.102 - Attacker:
192.168.0.104
- Information Gathering: The attacker passively listens for the real
OfferServicebroadcast from the server to learn theServiceID,InstanceID, and endpoints. It uses this to initialize itsServerdataand sends a spoofed offer to bait the client, catching the client'sSubscribeto initializeClientdata. - Initial Hooking: The attacker subscribes to the real Radio Service to receive its data.
- Isolation (MITM):
- The attacker sends a spoofed
StopOfferto the client (impersonating the server). - The attacker sends a spoofed
StopSubscribeto the server (impersonating the client).
- The attacker sends a spoofed
- Forwarding & Manipulation: The attacker now acts as a proxy. It intercepts
Eventsfrom the server, modifies their payload (e.g., changes text to "You got Hacked!"), and forwards them to the client.- Volume Hijacking: The attacker also manipulates control requests. When the client attempts to increase the volume (
+), the attacker intercepts the request and changes it to decrease the volume, and vice versa.
- Volume Hijacking: The attacker also manipulates control requests. When the client attempts to increase the volume (
Before running the services for the first time, build the Docker images:
docker compose buildStart the Server and Client first.
docker compose up -d server clientYou can attach to the client to play with the radio controls.
docker attach someip-pubsub-mitm-client-1Controls:
+/-: Increase/Decrease VolumeSPACE: Switch Radio StationESC: Turn Radio ON/OFFQ: Quit
(Press Ctrl+P, Ctrl+Q to detach without stopping the container).
To start the hack, launch the attacker container:
docker compose run --name attacker-running --rm attackerWatch the client's output. You will see the song text change to "You got Hacked!" as the attacker takes control.
To stop the demonstration and clean up the network:
- Stop the Attacker: Press
Ctrl+Cin the terminal where the attacker is running. - Stop all Services:
This stops the server and client and removes the internal network.
docker compose down
Note on Container Names: If you started the attacker with docker compose run --name attacker-running, use that name in your commands.
Using tcpdump pipe:
docker exec attacker-running tcpdump -i eth0 -U -w - | wireshark -k -i -Using Edgeshark: Alternatively, use Siemens Edgeshark to visually discover and capture traffic from any container's interface via your browser.
-
Start Attacker in Debug Mode: Use the specific debug configuration file to enable the debugger listener.
docker compose -f docker-compose.yml -f docker-compose.debug.yml --profile debug up attacker
You should see: "Starting with debugger listener on port 5678 (waiting for attachment)..."
-
Attach VS Code: A pre-configured
.vscode/launch.jsonis provided.- Ensure you have opened the root folder in VS Code.
- Go to the Run and Debug panel.
- Select "Python: Attach Attacker (Docker)" and hit Play.
