此處的 FDE 是指 Full Disk Encryption.
根據 [1] 這篇文章, 他在 Qualcomm 的系統中找到了 FED 的漏洞. 下面我把這篇文章的重點摘要出來, 細節就略過了.
首先我們都知道加密需要密碼, 因此好用的方式就是把硬體上的唯一密碼 (unique HW key) 和使用者輸入的密碼 (Passcode key) 做運算, 得到一個沒有人知道的新密碼. 下圖是 Apple iOS 用的方法. (KDF = key derivation function)
![]() |
| Apple’s FDE KDF |
試想, 如果我把整個 FLASH (eMMC or SD Card) 裡面的資料都加密了. 那我換了密碼之後, 是否要把整個資料重新加密一遍? 當然不可能, 新的密碼只能用來加密 “File key", 而加密真正資料 (file contents) 的 key 是不變的.
Android 的做法也類似 [2].
![]() |
| Android FDE’s KDF |
- 首先裝置隨機產生一個 16 byte 的 master key (Device Encryption Key – DEK), 然後準備一把鹽巴調味 (16 byte = 128 bit random-generated salt).
- 用 user password 加鹽巴 scrypt 出 32 byte (=256 bit) 的中間 key 1 (IK1 = intermediate key 1).
- 把 IK1 前面加一個 zero byte, 後面加 233 個 zero byte 墊成 256 bit (padded IK1) , 這是因為裝置上的 key (hardware-bound private key = HBK) 就是 256 byte.
- 用 HBK 去sign padded IK1. 產生 256 byte IK2.
- 用 IK2 加鹽巴 scrypt 出 32 byte IK3.
- 用 IK3 的前 16 byte 當 KEK (key encryption key), 後 16 byte 當 IV ( initialization vector).
- 把 DEK 用 AES-CBC 加密, 其中 KEK 和 IV 取材自上一步.
除了這些複雜的 key, iOS 和 Android 都有防止嘗試錯誤的軟體機制, 錯愈多次就要休息愈久. 所以破解方法就要用外部的硬體來做, 這也就是 Android 網頁上 [2] 所說的, 把產生 key 的方法複雜化, 以對抗 off the box 的破解. “In order to make the key resilient against off-box attacks, we extend this algorithm by signing the resultant key with a stored TEE key." 然而, 這樣還是被破了.
在 [1] 當中提到, 破壞的關鍵在於 key master module. 在 TEE (Trusted Execution Environment) 架構裡面, 有安全顧慮的動作, 都會由 REE (rich execution environment, non-secure world) 送到 TEE (secure world), 然後再把結果回傳 REE. Key master 本身長在 secure world, 理論上夠安全才對.

不過, 畢竟 TEE 需要 SW 實作, 所以從 binary code 可以被反組譯, 再搭配公開的 data structure, 就可以找出 HMAC (Keyed-Hash Message Authentication Code) [7]. 下圖中間的 QSEE 就是 Qualcomm Secure Execution Environment. 破解的流程如下:
- Enable the DACR (ARM 裡面的 Domain Access Control Register) in the TrustZone kernel to allow us to modify the code cave.
- Write a small shellcode stub in the code cave which reads the keys from the KeyMaster application.
- Hijack the “qsee_hmac" system-call and point it at our shellcode stub.
- Call the KeyMaster’s key-generation command, causing it to trigger the poisoned system-call and exfiltrate the keys into the shared buffer.
- Read the leaked keys from the shared buffer.

作者認為 FDE 雖然已經被公認是安全可靠加密方式, 但是在 Android + QSEE 的組合之下, 還是被找到了漏洞. QSEE 使用 SHK (hardware key) 衍生的 key 來加密, 作者認為不如直接用 SHK 比較好, 因為 SHK 反而保證是 SW 不能讀取的. 不過在其他的使用案例, 這樣又會有別的問題 [1].

