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.

0x0951204007A00100000
0x13300880100FF002000
0x1880000000000000000
0x19B00000F0000000000
0x1A0A0003C000091000B
0x244000000189C000000
0x2C1004000000800D500
0x3D27F00002200000061

At idle, everything scrolls by. Trigger an action to see which frame responds to it.

  1. Capture the traffic at idle: candump -l vcan0 records everything to a file.
  2. Trigger a single, repeated action: lock, flash the signal, accelerate.
  3. Compare before / after: the identifier and the byte that change give away the function.
  4. Narrow down: filter that identifier, isolate the byte, then the useful bit or range.
  5. Deduce the scale: vary the real-world quantity and note the relation (factor, offset, byte order).
Capture then observe
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.

The cluster displays
63km/h

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.

Forge and replay
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
  1. Build the frame: identifier#data in hex, with cansend.
  2. Emit in a loop, faster than the legitimate ECU, to win the arbitration.
  3. Or replay a capture: even without understanding the bytes, a replay is often enough.