LightEMU: Hardware Assisted Fuzzing of Trusted Applications

Haoqi Shan, Sravani Nissankararao, Yujia Liu, Moyao Huang, Shuo Wang, Yier Jin, Dean Sullivan

TL;DR

LightEMU is a high-performance fuzzing framework that "lifts" ARM TrustZone Trusted Applications (TAs) out of their isolated secure environments and runs them in the "Normal World" (Linux/Android). By leveraging ARM CoreSight hardware tracing for feedback, it achieves a 10x speedup over state-of-the-art tools and successfully uncovered three unique crashes in real-world production firmware.

What Problem Does This Paper Address?

ARM TrustZone is the backbone of mobile and IoT security, creating a "Secure World" (Trusted Execution Environment or TEE) to isolate sensitive tasks like fingerprint processing and disk encryption from the "Normal World" (the OS). However, this isolation makes security testing—specifically fuzzing—extremely difficult.

Traditional "grey-box" fuzzers (like AFL) rely on code coverage feedback to learn how to trigger new behaviors. In TrustZone, the hardware-enforced boundary prevents the fuzzer from seeing what the code is doing. Existing solutions are often:

  1. Black-box: Blindly sending inputs, which is slow and inefficient.
  2. Rehosting-based: Emulating the entire TEE OS, which is complex, slow, and requires proprietary knowledge of closed-source systems.
  3. Hardware-dependent: Requiring rare, unlocked developer boards that aren't available for most commercial devices.

Methods

The authors propose LightEMU, which treats the TA as a standalone binary rather than part of a monolithic secure system. Their approach involves several novel components:

  • TA Decoupling & T-Loader: TAs are typically ELF-like binaries. LightEMU uses a custom loader to resolve dependencies and map the TA into the Normal World's memory space, effectively "tricking" the TA into running on a standard Linux-based system.
  • Dynamic Binary Rewriting: TAs interact with the secure kernel via svc (system call) instructions. LightEMU uses the Capstone engine to find these instructions and patch them with jumps to a "syscall handler" that mimics the behavior of the original TEE OS.
  • Hardware-Assisted Tracing: Instead of slow software instrumentation, LightEMU uses ARM CoreSight, a built-in hardware debugging feature. This allows the fuzzer to collect branch-level coverage data at near-native execution speeds without modifying the TA's logic.
  • Stateful Fuzzing: Unlike standard programs, TAs often maintain internal state across multiple calls. LightEMU includes a state manager that works with AFL++ to track and explore these persistent states.

Datasets

The researchers evaluated LightEMU using:

  • Vulnerability Survey: An analysis of 180 TrustZone-related CVEs from the NIST database to categorize where bugs actually occur.
  • Real-World TAs: 8 TAs extracted from the production firmware of Samsung, Xiaomi, and Google devices.
  • Supported TEEs: The framework was adapted to support four major TEE implementations: Teegris (Samsung), Trusty (Google), OP-TEE (Open Source), and QSEE (Qualcomm).

Key Insights and Ideas

  • The "TA-First" Insight: The authors found that 81.1% of reported TrustZone vulnerabilities reside in the TAs themselves, not the underlying secure OS or hardware peripherals. This justifies "lifting" the TA for analysis; you don't need to emulate the whole world to find the majority of bugs.
  • Complexity Analysis: By analyzing the HDCP (content protection) TA, they found that 42.9% of code paths involve "complex dependencies" (like pointers to memory). This highlights why simple black-box fuzzing fails and why coverage-guided feedback is mandatory.
  • CoreSight as a Fuzzing Engine: Using hardware tracing (CoreSight) bypasses the "observer effect" where instrumentation slows down the target. It allows for "native binary-only" fuzzing, which is the holy grail for analyzing closed-source blobs.

Key Results

  • Performance: LightEMU achieved an execution speed of approximately 100 requests per second, which is a 10x speedup over previous state-of-the-art frameworks like TEEzz and PartEMU.
  • Bug Discovery: The tool triggered 3 unique crashes in real-world TAs that had already undergone vendor QA.
  • Fidelity: The authors compared execution traces from LightEMU against traces from the same TA running on actual secure hardware (an NXP i.MX8M board). The traces showed "high fidelity," proving that lifting the TA doesn't significantly change its execution flow.

Limitations and Future Work

  • Hardware Constraints: LightEMU currently requires an ARM Cortex-A platform with CoreSight enabled. It cannot yet be used on other architectures.
  • Peripheral Mocking: If a TA bug is deeply tied to a specific hardware peripheral (like a proprietary crypto-accelerator), LightEMU's syscall handler must be manually updated to mock that hardware, which can be labor-intensive.
  • Future Directions: The authors plan to extend the framework to support ARM Cortex-M (common in IoT) and Intel SGX (the x86 equivalent of TrustZone).

Summary updated

Abstract

Trusted Execution Environments (TEEs) are deployed in many CPU designs because of the confidentiality and integrity guarantees they provide. ARM TrustZone is a TEE extensively deployed on smart phones, IoT devices, and notebooks. Specifically, TrustZone is used to separate code execution and data into two worlds, normal world and secure world. However, this separation inherently prevents traditional fuzzing approaches which rely upon coverage-guided feedback and existing fuzzing research is, therefore, extremely limited. In this paper, we present a native and generic method to perform efficient and scalable feedback-driven fuzzing on Trusted Applications (TAs) using ARM CoreSight. We propose LightEMU, a novel fuzzing framework that allows us to fuzz TAs by decoupling them from relied TEE. We argue that LightEMU is a promising first-stage approach for rapidly discovering TA vulnerabilities prior to investing effort in whole system TEE evaluation precisely because the majority of publicly disclosed TrustZone bugs reside in the TA code itself. We implement LightEMU and adapt it to Teegris, Trusty, OP-TEE and QSEE and evaluate 8 real-world TAs while triggering 3 unique crashes and achieving x10 time speedup when fuzzing TAs using the state-of-the-art TrustZone fuzzing framework.
BibTeX
@inproceedings{shan2024lightemu,
  author = {Haoqi Shan and Sravani Nissankararao and Yujia Liu and Moyao Huang and Shuo Wang and Yier Jin and Dean Sullivan},
  title = {{LightEMU: Hardware Assisted Fuzzing of Trusted Applications}},
  booktitle = {Host},
  year = {2024},
  doi = {10.1109/host55342.2024.10545377},
}

Loading related content...

Figure