Reverse
Dissect and forge a frame
The real work: start from an unreadable bus, find the byte that drives a function, then craft the frame that commands it. Two workshops to see the method in action.
Dissect: find the right byte
Hook up to the bus and you see thousands of frames per second, all anonymous. Not one says "I am the speed". The method is a detective's: trigger a known action, and watch what changes.
That is exactly what cansniffer is for: it groups frames by identifier and highlights the bytes that move. You freeze the idle state, act on the car, then compare before and after.
Spot the byte that reacts
Trigger an action and watch which frame changes. Turn on "isolate" to hide the background traffic.
At idle, everything scrolls by. Trigger an action to see which frame responds to it.
- Capture the traffic at idle: candump -l vcan0 records everything to a file.
- Trigger a single, repeated action: lock, flash the signal, accelerate.
- Compare before / after: the identifier and the byte that change give away the function.
- Narrow down: filter that identifier, isolate the byte, then the useful bit or range.
- Deduce the scale: vary the real-world quantity and note the relation (factor, offset, byte order).
candump -l vcan0 # records to candump-*.log cansniffer -c vcan0 # grouped view, changing bytes in color
Once the identifier, the byte and the scale are known, you have the mapping - exactly what the Decoder tool works with.
Forge: build and inject
Knowing the mapping is not enough: you have to write the frame and send it. Forging means building an identifier and bytes, then emitting them onto the bus.
The catch: the real ECU has not gone away. It keeps emitting the correct value. Your frame and its frame fight over the instrument cluster - whichever emits more often wins. A single frame only produces one flicker.
The injection race
Raise the injection rate and watch the gauge flip over. Turn on SecOC to see the defense.
At a low rate, the real value takes over again: you have to emit faster than the ECU. SecOC rejects frames without a valid code, and the spoofing fails.
cansend vcan0 244#000000002EE00000 # one frame: 120 km/h while true; do cansend vcan0 244#000000002EE00000; done # hammer it to win canplayer -I candump-xxx.log # replay a capture verbatim
- Build the frame: identifier#data in hex, with cansend.
- Emit in a loop, faster than the legitimate ECU, to win the arbitration.
- Or replay a capture: even without understanding the bytes, a replay is often enough.