Smart Black Box Fuzzing of UDS CAN

Soohwan Oh (Blue Team Engineer · Autocrypt), Jonghyuk Song (Red Team Leader · Autocrypt), Jeongho Yang

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

Overview

This talk, "Smart Black Box Fuzzing of UDS CAN," presented by Jonghyuk Song on behalf of his co-authors Soohwan Oh and Jeongho Yang, delves into the critical and challenging domain of automotive cybersecurity testing. The core focus is on developing a methodology for black box fuzzing of Universal Diagnostic Services (UDS) over Controller Area Network (CAN) bus, specifically tailored for Electronic Control Units (ECUs) within the constraints of a black box environment. As employees of Autocrypt, a company specializing in mobility security, the speakers shared practical tips and know-how gleaned from their extensive experience conducting penetration tests and vulnerability assessments with major automakers and tier suppliers.

Watch on YouTube

Visual summary for Smart Black Box Fuzzing of UDS CAN by Soohwan Oh, Jonghyuk Song, Jeongho Yang
Visual summary for Smart Black Box Fuzzing of UDS CAN by Soohwan Oh, Jonghyuk Song, Jeongho Yang

Key moments

  1. 0:00 Introduction to smart blackbox fuzzing of UDS CAN
  2. 2:20 Defining the three blackbox fuzzing challenges
  3. 4:00 Solving fuzzing challenges using UDS features
  4. 6:00 Efficient test case generation: checking available UDS services
  5. 12:00 Four criteria for detecting failures during fuzzing
  6. 17:45 Automatic target reset for continuous fuzzing
  7. 22:00 Conclusion: Summary of smart blackbox UDS CAN fuzzing

Smart Black Box Fuzzing of UDS CAN

Speakers: Soohwan Oh (Blue Team Engineer, Autocrypt); Jonghyuk Song (Red Team Leader, Autocrypt); Jeongho Yang

Conference: Car Hacking Village @ DEF CON 30

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

Overview

This talk, "Smart Black Box Fuzzing of UDS CAN," presented by Jonghyuk Song on behalf of his co-authors Soohwan Oh and Jeongho Yang, delves into the critical and challenging domain of automotive cybersecurity testing. The core focus is on developing a methodology for black box fuzzing of Universal Diagnostic Services (UDS) over Controller Area Network (CAN) bus, specifically tailored for Electronic Control Units (ECUs) within the constraints of a black box environment. As employees of Autocrypt, a company specializing in mobility security, the speakers shared practical tips and know-how gleaned from their extensive experience conducting penetration tests and vulnerability assessments with major automakers and tier suppliers.

The automotive industry faces unique hurdles in security testing, primarily due to the proprietary nature of ECU software and the sheer complexity of modern vehicles, which integrate hundreds of interconnected ECUs. This often precludes the use of traditional white box testing methods like coverage-guided fuzzing or detailed crash triage. This talk proposes a "smart" approach that leverages the inherent features of the UDS protocol to overcome these limitations, providing a practical guide for security researchers and automotive engineers aiming to conduct effective fuzzing tests without access to source code or internal debugging interfaces. The methodologies presented are crucial for enhancing the resilience of vehicle systems against emerging cyber threats.

Background

▶ Watch: Introduction to smart blackbox fuzzing of UDS CAN (0:00)

The necessity for black box fuzzing in the automotive industry stems from several fundamental challenges. Automakers frequently operate without access to the source code of ECUs, as these components are often developed by tier suppliers who maintain proprietary control over their intellectual property. Furthermore, a modern vehicle can contain hundreds of ECUs, making it impractical, if not impossible, to obtain, instrument, and recompile the source code for every component to enable traditional white box fuzzing techniques. Consequently, testing the complete vehicle as an integrated system, where only external interfaces like the OBD-II port or CAN lines are accessible, becomes the default approach.

This black box environment introduces significant hurdles for effective fuzzing. Firstly, the absence of source code means coverage-guided fuzzing, which relies on monitoring code execution paths to generate more effective test cases, is impossible. Testers cannot observe which parts of the ECU's internal logic are being exercised by their inputs. Secondly, detailed crash triage—the process of identifying the exact cause and location of a software crash—is severely limited. Without access to internal debugger connections or detailed logging, testers can only infer system failures from external observations, such as unexpected responses or system behavior on the CAN bus. Finally, the challenge of automatically resetting a target ECU after a detected failure is paramount. Manual resets are time-consuming and inefficient for continuous fuzzing campaigns, but without internal access, triggering a reliable, automatic reset mechanism is difficult. These three core challenges—test case generation, failure detection, and target reset—form the bedrock of the problem statement addressed by the Autocrypt team.

Key Findings

▶ Watch: Solving fuzzing challenges using UDS features (4:00)

The central premise of this talk is that by intelligently leveraging the inherent features and standardized services of the UDS (Universal Diagnostic Services) protocol, the significant challenges of black box fuzzing in automotive environments can be effectively addressed. The speakers' key findings revolve around providing practical, UDS-centric solutions for the three aforementioned black box fuzzing hurdles: efficient test case generation, reliable failure detection, and automated target reset.

For test case generation, the research demonstrates that fuzzers can significantly enhance efficiency by first identifying and targeting only the available UDS services on a given ECU, rather than indiscriminately testing all 26 potential services. This process involves sending "verify messages" and interpreting Negative Response Codes (NRCs) to determine service support. Furthermore, the fuzzer must adhere to established UDS message sequences (e.g., performing a DiagnosticSessionControl before SecurityAccess) and comply with ISO-TP (ISO 15765-2) rules for transmitting multi-frame messages, ensuring that large payloads are correctly segmented and reassembled by the ECU.

In terms of failure detection, the talk outlines a robust, multi-criteria approach. Failures are identified not just by a complete lack of response, but also by specific Negative Response Codes (NRCs) that indicate deeper issues, the occurrence of new Diagnostic Trouble Codes (DTCs), and even the transmission of user-specified CAN messages that might signify dangerous or unexpected ECU behavior. This comprehensive detection strategy allows for a more nuanced and accurate assessment of ECU stability and vulnerability.

Finally, the most critical finding for enabling continuous black box fuzzing is the method for automated target reset. The speakers illustrate how the UDS services ECUReset (Service ID 0x11) and ClearDiagnosticInformation (Service ID 0x14) can be programmatically invoked to reliably bring a failed or unstable ECU back to a known operational state. This capability is indispensable for conducting long-duration fuzzing campaigns without constant manual intervention, transforming a previously labor-intensive process into an automated, scalable testing methodology.

Technical Deep Dive

▶ Watch: Efficient test case generation: checking available UDS services (6:00)

The "smart" approach to black box fuzzing of UDS CAN hinges on a detailed understanding and strategic exploitation of UDS protocol features. The speakers meticulously broke down their methodology into three core technical areas: test case generation, failure detection, and target reset.

Test Case Generation

Effective test case generation in a black box scenario requires intelligence beyond simple random mutation. The fuzzer developed by Autocrypt considers three primary factors:

  1. Efficiency through Service Availability Check:
  • The UDS standard defines 26 services, each with a unique Service ID. However, not all services are implemented or enabled on every ECU. In their experience, typically around 10 services are active.
  • To optimize fuzzing, the fuzzer first performs an availability check. It sends a "verify message" (a valid request) for each potential UDS service to the target ECU.
  • The ECU's response determines availability:
  • Positive Response: The service is available.
  • No Response: If no response is received within a defined timer period (typically 50 milliseconds in UDS), the service is considered unavailable.
  • Negative Response Code (NRC): Some NRCs indicate availability despite a "negative" outcome. For example, SubFunctionNotSupported (0x12) means the service itself is available, but the specific sub-function requested is not. This implies the fuzzer can mutate the sub-function value to potentially elicit a positive response. Conversely, ServiceNotSupported (0x11) unequivocally indicates the service is unavailable, and no further testing is needed for it.
  • By focusing only on available services, the fuzzer significantly reduces the test space and improves efficiency.
  1. Adherence to Message Sequences:
  • Certain UDS services require specific prerequisites or a defined sequence of operations. For instance, to test the WriteMemoryByAddress service, an ECU typically requires the diagnostic session to be properly initiated via DiagnosticSessionControl and security access to be granted using SecurityAccess beforehand.
  • Failure to follow these sequences will result in the ECU ignoring the request, rendering the test case meaningless. The fuzzer must therefore incorporate knowledge of these basic UDS message sequences into its test case generation logic.
  1. Multi-Frame Transmission (ISO-TP Compliance):
  • The CAN bus has a payload limit of 8 bytes per frame. For UDS messages with payloads exceeding this limit, the ISO-TP (ISO 15765-2) protocol is used to segment and reassemble the data across multiple CAN frames.
  • The fuzzer must correctly implement ISO-TP:
  • It first sends a First Frame containing the total message length and the initial data.
  • It then waits for a Flow Control frame from the ECU, which dictates parameters like the block size and separation time.
  • Finally, it transmits Consecutive Frames according to the Flow Control parameters until the entire payload is sent.
  • Incorrect ISO-TP implementation (e.g., simply sending a large payload without segmenting) will lead to the ECU ignoring the test case.

Failure Detection

Detecting failures in a black box environment is critical for identifying vulnerabilities and ensuring continuous fuzzing. The Autocrypt team proposed four criteria for failure detection:

  1. No Response to a Valid Request:
  • After transmitting a fuzzed test case, the fuzzer sends a subsequent, known-good "valid request" to the ECU (e.g., a simple ReadDataByIdentifier).
  • If the ECU fails to provide a positive response to this valid request within the UDS-specified 50-millisecond timer, it indicates a potential failure, implying the fuzzed input put the ECU into an unresponsive state.
  1. Specific Negative Response to a Valid Request:
  • Similar to the "no response" criterion, receiving certain NRCs to a valid request can also signal a failure.
  • While SubFunctionNotSupported (0x12) might be considered a "pass" in service availability checks (as the service is active), receiving ServiceNotSupported (0x11) or other critical NRCs (e.g., GeneralReject (0x10), ResponseTooLong (0x13), SecurityAccessDenied (0x33) in an unexpected context) to a valid request after fuzzing implies a system instability or an unintended state change caused by the fuzzed input. The fuzzer must intelligently interpret these NRCs.
  1. Diagnostic Trouble Code (DTC) Occurrence:
  • DTCs are standardized codes stored in an ECU's memory to indicate faults or abnormal operating conditions.
  • The fuzzer periodically sends a ReadDTCInformation (Service ID 0x19) request to the ECU.
  • If a new DTC is reported, it signifies a failure or an anomalous condition triggered by the fuzzed input.
  1. User-Specified CAN Message Occurrence:
  • This criterion allows testers to define custom rules based on observing the broader CAN bus traffic.
  • For example, when fuzzing a head unit ECU, a tester might specify that the occurrence of a CAN message indicating "brake pedal pressed" or "accelerator pedal pressed" should be considered a failure, as these messages are irrelevant to the head unit's normal operation and could signify a critical system malfunction or unintended side effect.
  • This method requires the fuzzer to actively monitor the entire CAN bus, not just the UDS communication with the target ECU.

Target Reset

Continuous fuzzing campaigns necessitate an automated mechanism to reset the target ECU after a detected failure. Manual intervention is impractical for long-duration tests. The talk highlights two crucial UDS services for this purpose:

  1. ECUReset (Service ID 0x11):
  • This service can initiate various types of resets on the ECU.
  • hardReset (Sub-function 0x01): This is the recommended reset type, akin to a power cycle or system restart, bringing the ECU to a fresh, known state.
  • softReset (Sub-function 0x03): This typically restarts the application program without a full power cycle. While sometimes effective, hardReset is generally preferred for thorough state initialization.
  1. ClearDiagnosticInformation (Service ID 0x14):
  • After a failure, especially one indicated by a DTC, it's crucial to clear the diagnostic memory to ensure that subsequent tests are not influenced by old fault codes.
  • This service clears all stored DTC data. By specifying FF FF FF as the parameter, the fuzzer can clear all diagnostic information.

The complete reset process involves: fuzzer detects a failure -> fuzzer sends ECUReset request -> fuzzer sends ClearDiagnosticInformation request -> fuzzer confirms the ECU has reset (e.g., by sending a valid request and receiving a positive response) -> fuzzing continues with the next test case. This automated loop ensures the efficiency and scalability of black box fuzzing.

Demo / Proof of Concept

▶ Watch: Automatic target reset for continuous fuzzing (17:45)

While the talk meticulously detailed the methodologies and practical steps for smart black box fuzzing, it primarily focused on the conceptual framework and the implementation strategy rather than presenting a live demonstration of a specific fuzzing tool or a real-world exploit. The speakers referenced "result overview left figure shows the example when there is no automatic reset and right one shows the example when there is a reset process" to illustrate the impact of automated reset on fuzzing continuity. This suggests that while a visual aid or internal data might have been used to show the effectiveness of their approach, the presentation itself was a practical guide rather than a showcase of a specific proof-of-concept exploit or a fully developed fuzzer in action. The emphasis was on sharing "tips and know-how" derived from their testing experience within Autocrypt.

Defensive Implications

▶ Watch: Conclusion: Summary of smart blackbox UDS CAN fuzzing (22:00)

The insights shared in this talk have profound implications for automotive manufacturers, tier suppliers, and cybersecurity professionals responsible for vehicle security. The primary defensive takeaway is the critical need for robust and secure implementations of the UDS protocol within ECUs. Developers must ensure their UDS services are not only compliant with standards but also resilient to malformed or unexpected inputs.

Defenders should proactively adopt the methodologies described for internal testing. Performing this type of "smart black box fuzzing" during the development and validation phases can identify vulnerabilities before vehicles reach production. Key areas of focus include:

  1. Robust UDS Service Implementations: ECUs must gracefully handle invalid Service IDs, Sub-function IDs, and data parameters. Instead of crashing or entering an unresponsive state, they should return appropriate Negative Response Codes (NRCs) (e.g., ServiceNotSupported, SubFunctionNotSupported, IncorrectMessageLengthOrInvalidFormat) without compromising system stability.
  2. Strict Message Sequence Enforcement: ECUs should rigorously enforce UDS message sequences. For instance, critical services like WriteMemoryByAddress should only be accessible after proper DiagnosticSessionControl and SecurityAccess have been established, and any deviation should be met with an appropriate NRC, not a system failure.
  3. Secure ISO-TP Handling: Implementations of ISO-TP must be robust, preventing buffer overflows or denial-of-service conditions when receiving malformed multi-frame messages or unexpected Flow Control frames.
  4. Minimizing DTC Triggers: While DTCs are essential for diagnostics, an ECU that frequently generates DTCs from slightly malformed UDS inputs indicates fragility. Developers should strive to minimize unintentional DTC occurrences from non-critical inputs, reserving them for genuine system faults.
  5. Hardening Reset Mechanisms: The reliance on ECUReset and ClearDiagnosticInformation for automated fuzzing also highlights these services as potential attack vectors. While necessary for diagnostics and recovery, access to these services should be strictly controlled, ideally requiring SecurityAccess for critical reset types.
  6. Monitoring and Logging: Enhance internal monitoring capabilities within ECUs to provide more detailed diagnostic information even in black box scenarios. This could involve improved internal logging that can be accessed via UDS ReadDataByIdentifier services, aiding in post-fuzzing analysis and crash triage.
  7. Threat Modeling UDS: Conduct thorough threat modeling specifically for the UDS protocol and its interactions with critical vehicle functions. Consider how an attacker might leverage UDS vulnerabilities to trigger dangerous CAN messages or compromise safety-critical systems.

By embracing these defensive strategies, automakers and suppliers can significantly enhance the cybersecurity posture of their ECUs and, by extension, the entire vehicle ecosystem.

Key Takeaways

  • Black box fuzzing is indispensable for automotive cybersecurity: Due to proprietary source code and complex ECU architectures, traditional white box testing is often impossible, making black box fuzzing a necessary approach for comprehensive vehicle security assessment.
  • UDS features are key to overcoming black box limitations: The standard UDS protocol provides mechanisms that can be intelligently leveraged for efficient test case generation, reliable failure detection, and automated target reset, transforming difficult challenges into manageable tasks.
  • Efficient test case generation requires intelligence: This involves dynamically checking for available UDS services, adhering to defined message sequences (e.g., DiagnosticSessionControl before SecurityAccess), and correctly implementing ISO-TP for multi-frame messages to ensure fuzzing inputs are processed by the ECU.
  • Robust failure detection is multi-faceted: Failures are not just crashes; they can be identified by the absence of a response, specific Negative Response Codes (NRCs), the occurrence of new Diagnostic Trouble Codes (DTCs), or even user-defined problematic CAN message transmissions.
  • Automated target reset is crucial for continuous fuzzing: Leveraging UDS services like ECUReset (especially hardReset sub-function 0x01) and ClearDiagnosticInformation (0x14) enables the fuzzer to automatically recover a failed ECU, making long-duration, scalable fuzzing campaigns feasible.
  • Proactive testing and robust UDS implementation are vital for defense: Automotive stakeholders should adopt these black box fuzzing techniques for internal validation and ensure their ECUs handle UDS requests with resilience, returning appropriate NRCs rather than crashing or entering unstable states.

About the Speaker(s)

The talk was presented by Jonghyuk Song, who serves as a Red Team Leader at Autocrypt. He was joined in the research by Soohwan Oh, a Blue Team Engineer at Autocrypt, and Jeongho Yang, also of Autocrypt. Their company, Autocrypt, is a specialized mobility security firm actively engaged in the automotive cybersecurity domain. Their work includes conducting "body tests" (presumably full-vehicle security assessments) and penetration tests with various automakers and tier suppliers. Autocrypt is also involved in developing a fuzzer specifically tailored for vehicle systems, underscoring their practical experience and expertise in the field of automotive cybersecurity.

Reviews

Dr. Zero (Offensive Security Researcher) — WEAK

This is a competent, entirely predictable primer on building a state-aware fuzzer for automotive CAN buses. The Autocrypt team lays out the baseline requirements for fuzzing UDS—endpoint discovery, ISO-TP fragmentation, and automated crash-recovery loops—but doesn't drop any tools, zero-days, or novel techniques. It fills a Car Hacking Village slot fine, but if you've ever built a fuzzer for a stateful protocol, you already know all of this.

Heather Calloway (CISO) — PASS

The speakers outline a method for automating black-box fuzzing against vehicle ECUs by leveraging standard diagnostic protocols to handle target resets and fault detection. For most enterprise CISOs, this is deep in the automotive engineering weeds and safely skipped. But if you run product security for an OEM or manage a logistics fleet, this demonstrates exactly how fast the 'proprietary black box' excuse is evaporating.

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

All talks from Car Hacking Village @ DEF CON 30