Abstract
ARM processors incorporate sophisticated debugging features to aid hardware development. However, the transition from physical JTAG-based debugging to software-accessible inter-processor debugging has introduced significant security risks. This paper presents the NAILGUN attack, an architectural exploit that leverages these features to bypass hardware-enforced isolation. By exploiting a "privilege blind spot" in ARM's debug authentication, an attacker can perform non-invasive tracing to steal secrets or invasive halting to escalate privileges to the highest level (EL3/TrustZone) without a single software vulnerability.
Introduction: The Shift in Debugging Models
Historically, debugging a processor required physical access to the chip via a JTAG port. ARM’s security model for debugging was built on this physical requirement, using hardware signals (e.g., DBGEN, SPIDEN) to determine if debugging was permissible based solely on the target's current state.
Starting with ARMv7, the introduction of the "inter-processor" debugging model fundamentally changed this landscape. This model allows one core on a System on Chip (SoC) to debug another core on the same chip via memory-mapped interfaces.
The critical flaw lies in the reuse of legacy authentication signals. These signals do not verify the privilege level of the "host" (the core initiating the debug session); they only check the "target." This creates a massive loophole where a low-privilege core can control a high-privilege core, effectively breaking the isolation between the Normal World (OS) and the Secure World (TrustZone).
The NAILGUN Attack Methodology
The researchers developed the NAILGUN attack to demonstrate how these architectural features can be weaponized. The attack is categorized into two forms:
Non-Invasive Attack
This variant utilizes the Embedded Trace Macrocell (ETM) to observe memory access patterns. By enabling tracing from a low-privilege state, an attacker can monitor sensitive computations occurring in the Secure World.
As shown in the figure above, tracing can be enabled at a low privilege level to capture data during high-privilege sensitive computations, which is then analyzed to recover secrets like AES keys. Traditional cache side-channel attacks require thousands of samples; NAILGUN makes key recovery trivial by providing exact memory addresses.
Invasive Attack
The invasive variant uses the Embedded Cross Trigger (ECT) to halt a victim core. Once the target is halted, the attacker uses the EDITR register to inject instructions. A key component of this attack is the dcps (Debug Change Privilege State) instruction. While intended for legitimate debuggers, NAILGUN uses it to instantly escalate the victim core to EL3, allowing for arbitrary code execution at the highest privilege level.
Experimental Evaluation and Results
The authors evaluated NAILGUN across a wide range of hardware, including development boards (ARM Juno r1), IoT devices (Raspberry Pi 3), and commercial mobile devices (Samsung Galaxy, Huawei, Xiaomi).
Key findings include:
- Universal Vulnerability: Most commercial devices had debug signals enabled by default, leaving them vulnerable out of the box.
- Fingerprint Theft: Successful extraction of fingerprint images from Secure World memory on the Huawei Mate 7, bypassing TrustZone protections.
- EL3 Code Execution: Demonstrated full system control via EL3 code execution on the Juno board.
- AES Key Recovery: Recovered 128-bit AES keys from an NXP i.MX53 board using non-invasive tracing in a single run.
Conclusion and Mitigations
The NAILGUN attack highlights a fundamental "privilege blind spot" in ARM's hardware design. Because the vulnerability is architectural, it does not rely on software bugs and is difficult to patch.
Mitigation requires a redesign of the debug model to include host-privilege checks. In the interim, SoC manufacturers must provide better documentation and mechanisms for disabling debug signals in production environments. Some vendors, like MediaTek, have already begun implementing hardware-based access controls for debug registers in response to this research.
Summary updated