A car's CAN bus is a shared broadcast network: every ECU can transmit a frame tagged with a fixed arbitration ID, and every other ECU can read it. The CAN protocol itself has no sender authentication — any node electrically on the bus can transmit any ID. Modern vehicles defend this with a zone gateway sitting between domains (powertrain, chassis, infotainment/telematics), inspecting every frame that tries to cross a boundary.
This simulator models two independent gateway defenses used in real automotive security architectures:
Domain isolation (whitelist):
block if domain_owner(arbitration_id) ≠ domain(origin_ECU)
Timing-based intrusion detection:
T_expected(id) = learned nominal period for that ID
Δt = t_now − t_last_seen(id)
flag if |Δt − T_expected(id)| > tolerance τ
- Domain isolation is structural: the compromised Infotainment ECU (a realistic entry point via a malicious OTA update or a spoofed V2X message) has no legitimate reason to originate the Brakes ECU's arbitration ID, so the gateway drops it on sight — regardless of timing.
- Timing IDS is statistical: it only flags a frame whose arrival breaks the learned periodic cadence of its ID. An attacker who mimics the real ECU's transmission rate closely enough can slip under a loose tolerance; too tight a tolerance instead starts rejecting legitimate traffic (a false positive) whenever normal jitter exceeds τ.
- Try switching domain isolation off and tuning the attack rate near the Brakes ECU's real 50 Hz cadence — the spoofed brake command can then evade the timing IDS entirely, which is exactly why real automotive gateways layer both defenses rather than relying on timing alone.
Real-world relevance: this mirrors ISO 21434 / UNECE R155 automotive cybersecurity guidance, which requires layered in-vehicle network defenses (gateway segmentation + anomaly-based IDS) precisely because CAN's arbitration protocol was never designed with authentication.