Project Overview

This project demonstrates an automotive cybersecurity implementation using a Raspberry Pi 5. It simulates a realistic vehicle network attack scenario, showing how a hacker can remotely control a vehicle's CAN Bus via a compromised connected device (e.g., a Wi-Fi Gateway). Furthermore, it implements a robust defense mechanism using HMAC Signatures and Rolling Counters..

Demo: Attack and Defense

This demo is placed first to highlight the core idea before diving into the technical details later.

CAN Bus Security Simulation: Attack vs. Defense

This project simulates two distinct scenarios, ranging from a completely vulnerable system to a secured architecture with a Security Gateway (Guardian).

Scenario 1: The Attack (Unprotected)

In this scenario, the internal vehicle network (vcan0) lacks any authentication mechanism. A hacker utilizes a compromised Web Gateway (main.py) to inject malicious CAN frames into the bus via HTTP requests, effectively spoofing the speedometer on the dashboard (IC Sim).

Scenario 1 diagram

Scenario 2: The Defense (Secured)

In this scenario, we introduce a Guardian (Security Gateway) and a Secure Sensor.

  • Network Segmentation: The network is split into an "Untrusted Zone" (vcan0) and a "Trusted Zone" (vcan1).
  • Authentication: The sensor signs data using HMAC-SHA256.
  • Anti-Replay: A Rolling Counter is implemented to prevent replay attacks.

The Guardian monitors vcan0, filters out forged packets from the hacker, and forwards only verified data to the dashboard located on vcan1.

Scenario 2 diagram