TL;DR
This paper introduces Reactive Peripheral Modeling (RPM), a novel paradigm that models hardware peripherals as stateful, reactive systems using Event-Condition-Action (ECA) semantics. The authors implement this in Bluezz, a framework that successfully rehosts and fuzzes complex Bluetooth Low Energy (BLE) firmware stacks, including closed-source commercial ones. Bluezz achieves over 2.6× the basic-block coverage of prior state-of-the-art tools and uncovered five new vulnerabilities in deep, post-connection protocol states.
What Problem Does This Paper Address?
Firmware rehosting—running embedded firmware inside a virtualized environment—is a powerful technique for security testing and fuzzing. However, existing hardware-layer emulators struggle with complex, timing-sensitive, and interdependent peripherals like wireless radios.
Prior approaches typically treat peripherals as passive endpoints, supplying fuzzed or static values to Memory-Mapped I/O (MMIO) reads and triggering interrupts randomly or periodically. This passive approximation breaks down for protocols like BLE because it ignores:
- Causal hardware events: The intricate interplay required between MMIO configurations, Direct Memory Access (DMA) transfers, and interrupt delivery.
- Implicit state transitions: Internal peripheral state changes driven by hardware logic rather than explicit CPU instructions.
- Cross-peripheral coordination: Direct hardware-level communication (e.g., a timer directly triggering a radio via a programmable peripheral interconnect) that bypasses the CPU entirely.
Consequently, existing tools get stuck in early initialization phases (like advertising or scanning) or drive the firmware into unrealistic, spurious crash states. They fail to reach the critical "deep" protocol states—such as connection establishment and data exchange—where the bulk of security-critical logic resides.
Methods
The authors propose Reactive Peripheral Modeling (RPM) to capture the dynamic, stateful nature of hardware. RPM defines peripheral behavior using structured Event-Condition-Action (ECA) rules (on event if condition(s) do action(s)).
The authors implemented this paradigm in a framework called Bluezz:
- Offline Model Construction: Bluezz automatically parses standard CMSIS-SVD (System View Description) files to generate the basic structural skeleton (register layouts, reset values) of a peripheral. Analysts (or an automated LLM agent) then enrich this skeleton with ECA rules derived from the hardware reference manual.
- Runtime Emulation: Built on top of the Unicorn engine and Fuzzware, Bluezz intercepts MMIO accesses at runtime. Instead of returning arbitrary values, it dispatches the corresponding ECA rules to update internal states, schedule DMA transfers, or fire interrupts in a causally valid sequence.
- Over-the-Air (OTA) Fuzzing: Rather than fuzzing internal registers directly, Bluezz feeds mutated inputs exclusively through the simulated packet-reception path of the radio peripheral, ensuring all discovered paths are realistically reachable by a remote attacker.
Datasets
The framework was evaluated on two distinct sets of targets:
- BLE Firmware Benchmark: 18 firmware samples built across three major real-world BLE stacks: NimBLE (open-source), Zephyr (open-source RTOS), and Nordic SoftDevice (a highly obfuscated, closed-source commercial stack). The samples covered five distinct use cases spanning various BLE roles (Scanner, Central, Peripheral, GATT Client, GATT Server).
- Generality Target: Grbl, a widely used open-source serial-protocol firmware for CNC milling running on an STM32F4 MCU, used to demonstrate that RPM generalizes beyond BLE.
Key Insights and Ideas
- Peripherals are State Machines, Not Data Buckets: Approximating a peripheral as a passive memory endpoint is fundamentally insufficient for complex protocols. Peripherals must be emulated as reactive state machines where inputs trigger sequential, cascading internal logic.
- Fuzz the Interface, Not the Internals: Injecting fuzz data directly into MMIO registers or random interrupts breaks state consistency. By routing fuzzed inputs strictly through realistic hardware entry points (like the radio receive buffer), the fuzzer avoids wasting time on unreachable, syntactically invalid execution paths.
- Hardware-Level Automation: Cross-peripheral shortcuts (like Nordic's PPI) mean hardware events can trigger other hardware tasks completely invisibly to the CPU. RPM successfully bridges this gap by chaining ECA rules together across different peripheral models.
- Agent-Assisted Modeling is Viable: While writing ECA rules requires manual analysis of hardware manuals, the structured nature of the rules makes them highly amenable to LLM assistance. An agent-assisted workflow reduced the manual modeling time for the complex nRF52840 platform from 12.5 hours to just 2 hours.
Key Results
- Coverage Multipliers: Across the 18 BLE targets, Bluezz achieved an average of 2.6× overall basic-block coverage and 4.9× BLE stack-related basic-block coverage compared to state-of-the-art fuzzers like Fuzzware and Hoedur.
- Deep Protocol Exploration: Bluezz is the first rehosting framework to systematically break past early initialization and reliably exercise connected BLE states (GATT processing, parameter negotiation).
- Vulnerability Discovery: Bluezz uncovered five previously unknown vulnerabilities in post-connection states within the Zephyr and NimBLE stacks, including double-free bugs, improper input validations, and critical assertion failures that can lead to remote Denial of Service (DoS). One has already been officially patched.
- Cross-MCU Generality: When applied to the non-wireless Grbl benchmark, Bluezz achieved over 70% code coverage, matching state-of-the-art results with manageable manual modeling effort (~4 hours).
Limitations and Future Work
- Upfront Modeling Effort: Although mitigated by agent assistance, creating the initial ECA models and preparing use-case drivers still requires human oversight to validate rules against hardware specifications.
- Protocol-Aware Input Models: Bluezz relies on role-aligned input models (derived from packet captures) to guide the fuzzer through complex packet sequences. Generating these models automatically for arbitrary protocols remains an open challenge.
- Future Extensions: The authors plan to scale Bluezz to support a wider variety of SoC vendors, real-world IoT firmware samples, and other complex protocol-driven embedded systems (e.g., Wi-Fi or Cellular).
Summary updated