Dissecting the Modern Android Data Encryption Scheme

Presented at REcon 2023, June 11, 2023, 4 p.m. (60 minutes).

Following our research on the Titan M, the security chip made by Google for their Android smartphones, we received a request from someone who had broken their device and was asking how they could recover the data despite the main SoC being dead. This question aroused our curiosity, and gave us the opportunity to play the forensic role and investigate how we could attack user data encryption on Android. We ended up asking ourselves how strong this mechanism is, against attackers who have access to a wide range of software vulnerabilities. To answer that question, we exploited two powerful known vulnerabilities, one in the Boot ROM of a Mediatek SoC and one in the Titan M, to attack the two mechanisms behind credential validation and key derivation: Gatekeeper and Weaver. In this talk, we present the logic behind the generation and storage of the keys for Android's user data encryption, called File-Based Encryption. Referencing the implementation in the AOSP (Android Open Source Project), we follow the steps performed by the system to generate the final encryption keys. Analyzing this process, we describe how elements from the file system, TEE and Secure Element (when present) are combined with the user's credentials, which still remain essential in the derivation. In two scenarios, one relying on TrustZone (and the Gatekeeper TA), and one relying on a security chip (implementing Weaver), we show strategies on how they can be attacked. In this context we use two known software vulnerabilities to build a PoC on a Samsung A22 and on a Pixel 3a, to highlight the difficulties that one may face with this task. This presentation brings together all the elements needed to fully understand user data encryption and authentication, touching the design principles, the implementation details and the necessary strategies to be adopted as an attacker. We hope this work can be an up to date reference, which can help other researchers reviewing these mechanisms and their internals.

Presenters:

  • Damiano Melotti
    Damiano Melotti (@DamianoMelotti) is a security researcher at Quarkslab. He is mostly interested in systems security, especially in mobile platforms (Android), and automated vulnerability research.
  • Maxime Rossi Bellom
    Maxime Rossi Bellom (@max_r_b) is a Security Researcher and R&D Leader working at Quarkslab, focusing on the hardware and low level software security of mobiles devices and embedded systems. He loves playing with secure boot, and security chips embedded in smartphones. His latest notable work was on the Titan M chip of Google, and was presented in multiple conferences including Black Hat USA, Troopers, and Black Hat Europe.

Links:

Similar Presentations: