Downgrade Attack on TrustZone

Yue Chen, Yulong Zhang, Zhi Wang, Tao WeiarXiv 2017

Introduction

Modern mobile security relies heavily on the Trusted Execution Environment (TEE), with ARM TrustZone being the industry standard. TrustZone creates a hardware-isolated "Secure World" to handle sensitive operations like biometric authentication, mobile payments, and Digital Rights Management (DRM), keeping them separate from the potentially compromised "Normal World" (the standard Android OS).

Architecture of ARM TrustZone showing the isolation between Normal and Secure Worlds.

Within this architecture, specialized unprivileged applications known as "trustlets" run on a Trusted OS. While the system verifies the cryptographic signatures of these trustlets before execution, a critical flaw exists in many implementations: the lack of robust rollback prevention.

The Downgrade Vulnerability

The core of the "downgrade attack" lies in the reuse of cryptographic keys across different software versions. When a vendor identifies and patches a vulnerability in a trustlet, they issue an update. However, because the older, vulnerable version of the trustlet was also signed with the same valid vendor key, the Trusted OS will still accept it if it is re-introduced to the system.

An attacker who has gained root access in the Normal World can replace the patched trustlet files on the device's file system with older versions extracted from previous firmware. Since the TEE lacks a mechanism to check if the version being loaded is the most recent one, it executes the vulnerable code, effectively resurrecting exploits that were supposedly fixed by security patches.

Methodology: Reverse Engineering the Chain of Trust

To demonstrate the feasibility of this attack, researchers employed a combination of live exploitation and deep reverse engineering. By rooting flagship devices—including the Google Nexus 5 and 6, Samsung Galaxy S7, and Huawei Mate 9—they were able to manually swap trustlet binaries.

The researchers used hex editors and pattern matching to identify X.509 certificates and RSA public key moduli within firmware images. This allowed them to map the verification keys used by different OEMs.

Hex dump of a Samsung firmware binary showing version control parameters like SW_ID and HW_ID.

As shown in the analysis of firmware metadata (e.g., Figure 3), parameters like SW_ID are intended for version control. However, the study found that these fields were frequently misconfigured or left at default values (e.g., 0), rendering the built-in anti-rollback mechanisms inactive.

Experimental Results and Impact

The researchers successfully executed a "resurrection" of CVE-2015-6639, a known privilege escalation vulnerability in the widevine trustlet. By downgrading the trustlet on a fully patched Nexus 6 to an older build, they bypassed the security patch and successfully exploited the device.

The vulnerability was found to be widespread across major vendors, though the implementation details varied:

  • Qualcomm: Uses standard X.509 certificates embedded in the binaries.
  • Trustonic (Samsung): Employs raw 256-byte RSA moduli.
  • Huawei: Dynamically derives public keys from hardware and encrypts trustlets, adding a layer of complexity but not preventing the downgrade if the entire encrypted package is swapped.

Beyond user-space trustlets, the researchers even managed to downgrade the TrustZone OS itself and secondary bootloaders on certain devices, demonstrating a systemic failure in the chain of trust.

Conclusion and Mitigation

The study highlights that patching a vulnerability is insufficient if the system continues to trust the vulnerable version of the code. The fragmentation of the Android ecosystem further complicates the deployment of a universal fix.

The most effective solution is the implementation of hardware-backed anti-rollback counters. These counters, stored in non-volatile, secure memory (like eFuses), should be incremented with each security update. The hardware then refuses to execute any code with a version number lower than the current counter value. While some newer devices have begun implementing these hardware-level protections, many legacy devices remain vulnerable to downgrade attacks.

Summary updated

BibTeX
@misc{chen2017downgrade,
  author = {Yue Chen and Yulong Zhang and Zhi Wang and Tao Wei},
  title = {{Downgrade Attack on TrustZone}},
  year = {2017},
  eprint = {1707.05082},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1707.05082},
}
Figure