Getting Naughty on CAN bus with CHV Badge

Dave Robins (CEO · Intrepid Control Systems)

Car Hacking Village @ DEF CON 30 · Day 1 · Car Hacking Village

Overview

In this highly technical and insightful talk from DEF CON 30's Car Hacking Village, Dave Robins, CEO of Intrepid Control Systems, unveils the capabilities of the Car Hacking Village (CHV) badge, a powerful and accessible tool for interacting with the Controller Area Network (CAN) bus. The core of the badge's functionality lies in the innovative Raspberry Pi RP2040 microcontroller, specifically its dual-core architecture and groundbreaking Programmable I/O (PIO) engines. Robins demonstrates how this low-cost hardware can achieve cycle-accurate bit banging, enabling sophisticated generation and reception of CAN messages, including various "kill" attacks that can disrupt vehicle communication.

Watch on YouTube

Visual summary for Getting Naughty on CAN bus with CHV Badge by Dave Robins
Visual summary for Getting Naughty on CAN bus with CHV Badge by Dave Robins

Key moments

  1. 4:40 Hardware overview and initial badge demo
  2. 7:00 Live demonstration of a CAN bus "kill"
  3. 12:00 RP2040's unique PIO bit-bang processors
  4. 29:00 Code demo: CPU bit-banging CAN transmit
  5. 42:00 Code demo: PIO bit-banging CAN receive
  6. 51:00 Oscilloscope visualization of generated CAN errors
  7. 54:00 Exploring badge configuration via USB serial console
  8. 59:00 Integration with Canis Labs advanced CAN attacks

Getting Naughty on CAN bus with CHV Badge

Speakers: Dave Robins (CEO, Intrepid Control Systems)

Conference: Car Hacking Village @ DEF CON 30

YouTube: https://www.youtube.com/watch?v=xXDgpneZGqo

Overview

In this highly technical and insightful talk from DEF CON 30's Car Hacking Village, Dave Robins, CEO of Intrepid Control Systems, unveils the capabilities of the Car Hacking Village (CHV) badge, a powerful and accessible tool for interacting with the Controller Area Network (CAN) bus. The core of the badge's functionality lies in the innovative Raspberry Pi RP2040 microcontroller, specifically its dual-core architecture and groundbreaking Programmable I/O (PIO) engines. Robins demonstrates how this low-cost hardware can achieve cycle-accurate bit banging, enabling sophisticated generation and reception of CAN messages, including various "kill" attacks that can disrupt vehicle communication.

The significance of this talk extends beyond automotive security. Robins illustrates how the RP2040’s unique features make it an ideal platform for exploring and attacking a wide array of digital protocols that were previously difficult to manipulate with commodity hardware. By providing a detailed technical deep dive into the microcontroller's architecture and the custom C++ code developed for the badge, the presentation empowers security researchers, hardware hackers, and automotive enthusiasts to conduct novel research, discover zero-day vulnerabilities, and gain a deeper understanding of embedded system interactions. The CHV badge serves as both an educational instrument and a formidable attack platform, democratizing access to advanced protocol manipulation techniques.

Background

▶ Watch: Hardware overview and initial badge demo (4:40)

The CAN bus has been a cornerstone of automotive electronics for decades, but its prevalence extends to industrial machinery, marine vessels (e.g., NMEA 2000), and even medical equipment. Designed for robustness and cost-effectiveness, CAN's inherent lack of security mechanisms makes it a frequent target in car hacking research. Understanding and manipulating CAN messages is fundamental to vehicle security, whether for aftermarket modifications or identifying vulnerabilities. Intrepid Control Systems, founded in 1994, has a long history of developing test tools for the automotive industry, including popular products like Vehicle Spy, ValueCAN, and neoVI interfaces, giving them deep expertise in vehicle network protocols, including CAN and the emerging Automotive Ethernet. Their work often involves benchmarking and reverse engineering vehicle systems, which naturally overlaps with cybersecurity efforts.

The challenge in embedded systems security often revolves around the cost and complexity of specialized tools. Traditional embedded development environments and debuggers can be prohibitively expensive, and custom hardware for cycle-accurate protocol manipulation often requires complex Field-Programmable Gate Arrays (FPGAs), which are power-hungry, expensive, and difficult to program. The advent of low-cost, high-performance microcontrollers like the Raspberry Pi Pico, featuring the RP2040 chip, marks a significant shift. Furthermore, the global chip shortage of recent years highlighted the critical importance of component availability, making the RP2040's consistent supply a major advantage. This convergence of factors created an opportunity to develop an accessible, powerful tool like the CHV badge, enabling researchers to explore protocol interactions in ways previously limited by hardware constraints.

Key Findings

▶ Watch: RP2040's unique PIO bit-bang processors (12:00)

The central finding of this talk is the demonstration of the Raspberry Pi RP2040 microcontroller as a revolutionary platform for cycle-accurate bit banging of high-speed digital protocols, particularly the CAN bus. Robins highlights several key aspects of the RP2040 that make this possible:

  • Availability and Low Cost: The RP2040 chip is readily available, even in thousands of quantities, costing as little as 70 cents in bulk. The Raspberry Pi Pico board, which hosts the RP2040, is priced at just $4-6, including a newer Wi-Fi enabled version. This democratizes access to advanced embedded development and security research.
  • Dual ARM Cortex-M0+ Cores: The RP2040 features two independent CPU cores, allowing one core to handle general application logic (like USB communication) while the other is dedicated to highly deterministic, cycle-accurate protocol generation or reception without interruption.
  • Single-Cycle I/O: A critical innovation of the Cortex-M0+ core is its ability to perform certain I/O operations in a single clock cycle (8 nanoseconds at 125 MHz). This enables direct manipulation of GPIO pins at extremely high, predictable speeds, making bit banging feasible for protocols up to 62.5 MHz.
  • Bus Matrix with Independent SRAM: The RP2040's internal bus matrix allows its dual cores and DMA controllers to access different SRAM banks simultaneously without blocking each other. This ensures deterministic execution speeds for each core, crucial for precise timing.
  • Programmable I/O (PIO) Engines: Described as a "total breakthrough" and "game changer," the RP2040 includes two PIO modules, each containing four independent, cycle-accurate bit-bang processors. These state machines, with their own small instruction sets and FIFOs, can operate in parallel, handling complex, time-sensitive tasks like CAN reception or even multiple CAN channels simultaneously, offloading the main CPU cores.
  • Dynamic Assembly Generation: The talk showcases a novel C++ class that dynamically generates ARM Cortex-M0+ assembly instructions at runtime. This allows for highly flexible and precise control over bit timing and protocol sequencing, tailored to specific attack scenarios or experimental conditions.

These combined features allow the CHV badge to perform sophisticated CAN bus attacks, such as generating continuous dominant bits for denial of service, injecting invalid frames, or manipulating bit timings to test ECU robustness, all with unprecedented control and at a fraction of the cost of previous solutions.

Technical Deep Dive

▶ Watch: Code demo: PIO bit-banging CAN receive (42:00)

The technical core of the CHV badge's capabilities lies in the sophisticated utilization of the RP2040 microcontroller's unique architecture. Dave Robins meticulously details how the dual-core design, single-cycle I/O, and particularly the PIO engines are leveraged for cycle-accurate CAN bus interaction.

The RP2040 features two ARM Cortex-M0+ cores, each capable of running at up to 125 MHz (and potentially overclocked to over 300 MHz). This dual-core setup is crucial: one core can manage higher-level tasks like the USB serial console and inter-core communication, while the other is fully dedicated to time-critical protocol manipulation. To ensure deterministic execution, the RP2040 employs Single-Cycle I/O. Unlike standard ARM processors where load/store instructions for memory-mapped I/O typically take multiple cycles, the Cortex-M0+ core can directly manipulate specific GPIO addresses in a single 8-nanosecond clock cycle. This allows for extremely precise, high-frequency bit toggling, essential for bit-banging fast protocols.

Memory access determinism is further achieved through a bus matrix and striped SRAM. The RP2040’s SRAM is divided into banks, allowing the two cores and DMA engine to access different banks concurrently without contention. For highly deterministic operations, code and stack can be placed in a dedicated 4KB "scratch X" SRAM bank, ensuring no blocking from other cores. Inter-core communication is handled via FIFOs, providing a deterministic, non-blocking mechanism for one core to pass data or commands to the other.

For CAN message generation, the badge utilizes one of the CPU cores. The software employs a custom C++ class that dynamically generates ARM Cortex-M0+ assembly instructions. This class builds sequences of move, store, branch, and logical shift instructions to precisely control GPIO output. For instance, toggling a GPIO from high to low involves storing to specific "set" or "clear" memory-mapped addresses. Crucially, precise delays are achieved by calling cycle-accurate delay subroutines using branch and link instructions. The process involves first constructing the raw CAN message bits, including CRC calculation and bit stuffing (a CAN protocol feature to prevent long sequences of identical bits), and then translating these bits into the exact sequence of assembly instructions and delays required to transmit them on the CAN bus at the specified baud rate (e.g., 500 kilobits per second, where each bit is 2 microseconds long). The speaker notes that the Cortex-M0+ has a two-stage pipeline, meaning branches take two cycles, a detail critical for porting this cycle-accurate code.

CAN message reception, however, is ideally suited for the Programmable I/O (PIO) engines. The RP2040 has two PIO modules, each containing four independent state machines. These state machines are essentially tiny, highly deterministic processors with a simple instruction set (only 8 instructions: jump, wait, in, out, push, pull, move, irq). Each instruction can have its own delay, making them perfectly suited for cycle-accurate protocol parsing. For CAN reception, a PIO state machine is configured to:

  1. Wait for the CAN bus to go low (signaling a Start of Frame).
  2. Sample the bus at precise intervals (e.g., 24 clocks into a 32-clock bit period for a 75% sample point).
  3. Shift the sampled bits into an internal shift register (in instruction).
  4. Push collected bits from the shift register into a 32-bit FIFO, which can be configured to hold up to 8 words (256 bits), allowing it to capture an entire CAN frame without CPU intervention.
  5. Generate an interrupt (IRQ) to the main CPU when the FIFO is ready or a message ends.

The CPU then reads data from the PIO FIFO, performs bit destuffing, and reconstructs the CAN message. While the demonstration's PIO-based receiver is a "crappy decoder" that lacks resynchronization (a key CAN feature where the receiver adjusts its clock on dominant edges) and full acknowledgment handling, Robins emphasizes that these are capabilities the PIO could achieve with more development. The PIO's ability to run multiple state machines in parallel means it could simultaneously monitor up to eight CAN channels. For a 500 kbps CAN bus, with an 8 ns clock, there are approximately 250 CPU instructions available per bit time, offering immense flexibility for complex protocol operations. This allows for independent transmit (CPU) and receive (PIO) operations, or even PIO-based transmission with CPU-based reception for more complex decoding and acknowledgment.

Demo / Proof of Concept

▶ Watch: Oscilloscope visualization of generated CAN errors (51:00)

The CHV badge itself is the primary demonstration platform, showcasing the RP2040's capabilities. The badge features a Raspberry Pi Pico (housing the RP2040), a Microchip CAN physical layer transceiver (capable of CAN FD, though not used in the demo), two buttons, two switches, several LEDs, a buzzer, and a small display with a QR code linking to more information. While only running on USB power for most features, it can flash an LED from a battery.

Upon plugging in, the badge offers predefined "kill" functions triggered by button presses:

  • "Never gonna let you talk": Generates continuous dominant (zero) frames on the CAN bus. Since zero is the highest priority bit, this effectively performs a Denial of Service (DoS), preventing other nodes from transmitting. Robins warns that plugging this into older, untested cars can cause complete system shutdowns. An oscilloscope trace shows continuous low signals.
  • "CAN's in jeopardy": Generates error frames, disrupting communication by intentionally violating CAN protocol rules. An oscilloscope trace demonstrates the 16-microsecond error frame pattern (8 pulses of 2-microsecond bit time).
  • "Random kill": Generates messages with random IDs, random data, and random delays, sometimes including errors, to stress test the robustness of target ECUs.

Beyond these predefined attacks, the badge features a comprehensive USB serial console interface. This console allows users to configure highly granular "arbitrary kills," enabling sophisticated protocol manipulation:

  • CAN ID, data, and frame length customization.
  • Injection of invalid CRC or invalid R0 bits (a common issue for some CAN controllers).
  • Manipulation of inner frame separation time and end of frame separation time to violate protocol rules.
  • Generation of specific error frames.
  • Support for extended CAN frames (29-bit IDs) used in trucking and industrial applications.
  • Ability to generate remote frames.
  • Ramping of CAN data (e.g., "walking ones" pattern), inner frame period, bit period (to test ECU response to timing variations), and CAN ID.

The demonstration extensively uses a PicoScope oscilloscope connected to the CAN transceiver's digital logic pin. This visualizes the generated waveforms, confirming the precise timing of the bit-banged signals. For example, a 500 kilobit/second CAN bus translates to a 2-microsecond bit time, clearly visible on the scope. The speaker also briefly mentions the badge's CAN monitor feature, which uses the PIO code for basic CAN ID decoding, though acknowledges some decoding bugs in the demo version.

Finally, Robins highlights that CANis Labs, a company co-founded by Dr. Ken Tindall, has ported their CAN Hack software to the CHV badge. This provides an alternative Python-based API for generating various CAN attacks, further expanding the badge's utility and leveraging existing research into CAN cybersecurity.

Defensive Implications

▶ Watch: Integration with Canis Labs advanced CAN attacks (59:00)

The CHV badge, and the underlying capabilities of the RP2040, present significant implications for cybersecurity defenders, particularly in the automotive and industrial control sectors. The ease, low cost, and precision with which this hardware can interact with digital protocols like CAN bus mean that defensive strategies must evolve beyond simply adhering to protocol specifications.

  1. Robustness Against Malformed/Non-Standard Traffic: Systems, especially ECUs in vehicles, must be designed and tested to be robust against deliberately malformed or non-standard protocol interactions. This includes invalid CRCs, incorrect frame lengths, violations of inter-frame and end-of-frame separation times, and "stuffing errors." The badge's ability to ramp bit periods also highlights the need to test how ECUs handle slight deviations in expected clocking.
  2. Denial of Service (DoS) Mitigation: The "never gonna let you talk" kill, which floods the bus with dominant zeros, is a simple yet effective DoS attack. ECUs must have mechanisms to gracefully handle bus-off conditions, excessive error frames, or continuous high-priority traffic without causing critical system failures.
  3. Beyond Standard Controllers: Relying solely on the error handling and filtering capabilities of off-the-shelf CAN controllers might not be sufficient. The RP2040's bit-banging capabilities allow attackers to bypass the limitations of standard CAN controllers and craft highly specific, non-compliant frames that might exploit edge cases or vulnerabilities in ECU firmware.
  4. Comprehensive Fuzzing: The badge provides a platform for highly customizable fuzzing of CAN interfaces. Defenders should utilize similar tools to conduct extensive stress testing and fuzzing campaigns against their own systems, exploring the full range of possible protocol interactions, not just valid ones.
  5. Education and Awareness: Engineers designing embedded systems need to be aware of these advanced protocol manipulation techniques. The assumption that "the protocol is robust" or that "only valid messages will be sent" is a dangerous one. Training on threat modeling for embedded systems should include scenarios involving cycle-accurate bit-level attacks.
  6. Supply Chain Security: The availability of powerful, low-cost microcontrollers like the RP2040 means that sophisticated attack tools can be built and deployed by a wider range of actors. This decentralization of advanced attack capabilities emphasizes the need for robust security measures throughout the product lifecycle, from design to deployment.

Ultimately, the CHV badge serves as a stark reminder that physical layer and protocol-level attacks are increasingly accessible. Defenders must move beyond superficial security checks and delve into the intricate details of how their systems respond to malicious and unexpected digital signals.

Key Takeaways

  • The Raspberry Pi RP2040 microcontroller, with its dual ARM Cortex-M0+ cores, single-cycle I/O, and revolutionary Programmable I/O (PIO) engines, is a game-changer for low-cost, cycle-accurate bit banging of digital protocols.
  • The Car Hacking Village (CHV) badge demonstrates the RP2040's power by enabling highly precise generation and reception of CAN bus messages, including sophisticated "kill" attacks like Denial of Service and error frame injection.
  • Cycle-accurate protocol manipulation, achieved through techniques like dynamic ARM assembly generation and PIO state machines, allows for novel attacks that exploit edge cases and vulnerabilities in how systems handle non-standard or malformed data.
  • Defenders in automotive and industrial control sectors must prioritize robustness testing against a wide range of non-compliant protocol interactions, including invalid CRCs, timing violations, and continuous high-priority traffic, as traditional CAN controller defenses may not be sufficient.
  • The badge serves as an accessible educational tool for security researchers and enthusiasts to learn about embedded systems hacking and explore digital protocols at a granular level, fostering discovery of new zero-day vulnerabilities.
  • The availability and low cost of hardware like the RP2040 lower the barrier to entry for advanced protocol analysis and attack, necessitating a proactive and in-depth approach to embedded system security.

About the Speaker(s)

Dave Robins is the CEO of Intrepid Control Systems, a company he founded in his college dorm room in Ann Arbor, Michigan, in 1994. With over 30 years of experience, Robins describes himself as passionate about computers and electronics, having started his career in hardware but quickly embracing the software side of microcontrollers. His extensive background spans a wide array of programming languages and paradigms, including assembly code, C, Python, GPU programming, FPGA programming, and embedded Linux.

Under Robins' leadership, Intrepid Control Systems has grown into a global company with around 200 employees and offices across Asia and Europe. The company specializes in providing test tools for the automotive electronics industry, supporting OEMs with equipment developed to their specifications and often working on technologies that will appear in production vehicles three to five years out, such as Automotive Ethernet. Intrepid has also been involved in developing cybersecurity tools for benchmarking and understanding how car systems work, which naturally feeds into car hacking research. Dave Robins is also a self-described dog person, who, despite being too busy to own a dog, enjoys part-time dog watching.

Reviews

Dr. Zero (Offensive Security Researcher) — MUST SEE

Dave Robins took a $4 piece of silicon and turned it into a cycle-accurate CAN injection tool that usually requires a $3,000 FPGA. By abusing the RP2040's Programmable I/O (PIO) engines and dynamic ARM assembly generation, he bypasses standard CAN controllers entirely to craft raw physical-layer attacks. Mandatory viewing if you're fuzzing automotive or industrial buses.

Heather Calloway (CISO) — STRONG ACCEPT

Dave Robins demonstrates how a $5 microcontroller can perform cycle-accurate CAN bus attacks that previously required specialized, expensive hardware. For leaders managing manufacturing floors or logistics fleets, the business takeaway is unavoidable: the financial barrier to physical-layer protocol disruption has vanished.

→ Top-rated talks at Car Hacking Village @ DEF CON 30

All talks from Car Hacking Village @ DEF CON 30