OBD-II and ELM327 (4), man in the middle framework

In previous post, I realized that ELM327 is not ideal platform to do car hacking. I need to develop some more *interesting* hacking tool to achieve the job. So I turned to Raspberry Pi to continue development


Implement a CAR by Raspberry Pi (Pi-CAR)

ELM327 communicates to a car, so I need to make a CAR... What?



I used a Raspberry Pi plus CAT-HAT to behave like a VOLVO XC60. The HW installation is not difficult, and I used PYTHON-CAN to write car emulator. So it can receives query from ELM327, and responds 0902 (VIN query command)

  • ELM327 ---- Pi-CAR
    • Left rectangular is ELM327, which queries VIN via 0902 command
    • 500kbps CANBUS wire, in the right-buttom corner, connects between ELM327/Pi-CAR
    • Right rectangular is RPi, it responds 0902 command. He says: I'm a Volvo XC60

The experiment shown above
  • Upper window is ELM327 serial port. You can double confirm the result with earlier post. It had the same response as I connected ELM327 to real car
  • Lower window is the RPi screenshot. It also reveals more detail of 0902 transaction
    • ELM327 sends 0902 query
    • RPi responses the 1st response
    • ELM327 sends 0x30 which queries remaining message (refer to ISO15765-2 for more detail)
    • RPi responses the 2nd/3rd packets

Now ELM327 behaves like communicating a CAR, that's the initial part of hacking...


Implement a WIRE by Raspberry Pi (Pi-WIRE)

Now use another board of Raspberry Pi, equipped two CAN transceiver, I want to implement a *wire* (Pi-WIRE). You can imagine that this board is invisible between ELM327 & Pi-CAR. They don't know the packet is bypassed by Pi-WIRE




  • ELM327 ---- Pi-WIRE ---- Pi-CAR
    • All configuration kept the same except Pi-WIRE is introduced
    • Pi-WIRE is a cable
      • Packet from ELM327 is re-directed to Pi-CAR, and it sniffered (I know what ELM327 talked)
      • Packet from Pi-CAR is re-directed to ELM327, and it sniffered (I know what Pi-CAR talked)
The experiment result now has 3 windows, the upper/lower windows is the same as previous step (both ELM327/Pi-CAR doesn't know the existence of Pi-WIRE). The middle one is MITM (man in the middle) result. It knows the packet from both side





Many Interesting Staff of Pi-WIRE

I had a HUD connecting to OBD-II. So I can use Pi-WIRE to do reverse engineering toward OBD-II, to know how HUD works. We can verify these add-on OBD dongles' behavior. However, I don't have confidence to connect these *toys* to the real cars (I probably need some box to fasten them first)



Before I connect these staff into the car, I would talk some pitfall encountered during making these tools

Comments

Popular posts from this blog

OBD-II and ELM327 (1)

OBD-II and ELM327 (3), try to decode CAN package recorded by ELM327

OBD-II and ELM327 (2), the underlying interface of ELM327