是时候谈谈 TEE 了
It's time to talk about TEEs

原始链接: https://alinush.github.io//tee

本文认为,由于架构复杂性、侧信道以及大量攻击,TEE 对于高价值秘密而言风险很高。即使是安全飞地,也可能因飞地代码中的漏洞而被攻破,例如 Signal 的联系人发现漏洞。远程证明伪造攻击反复针对 Intel SGX/TDX 和 AMD SEV,包括 Foreshadow、SGAxe、ÆPIC Leak、BadRAM、WireTap.fail、TEE.fail、Battering RAM 和 DDRrop;其中部分利用物理访问或中间插入。将证明固定到自己的证书上有所帮助,但容易出错。可用性问题和众多学术攻击进一步削弱了信心。更原则性的 TEE 设计存在,但通常以牺牲性能或功能为代价。总体而言,应避免将高价值秘密存储在 TEE 中,尤其是在可能遭受物理攻击的情况下。

TEEs 引发争议:SGX 与 AMD SEV 提供硬件支持的安全性,但面临漏洞、物理限制与可用性挑战。一位评论者认为 TEEs 常服务于 DRM 或云营销;另一位则认为它们不完美但可修补,指出 SGX 是为重新封装设计的,而 AMD SEV 更糟。Retr0id 澄清 TEEs 应作为纵深防御,而非唯一安全手段,因为伪造的证明可能破坏薄弱系统。Mike 将 TEEs 比作信用卡芯片:不完美但实际有价值。Retr0id 反驳说,对卡片的物理攻击无法规模化。总体而言,TEEs 在不被过度信任的情况下可以增强安全性,但需要谨慎实施和现实的威胁模型。
相关文章

原文

$ $

This post surveys some concerning attacks on TEEs. The goal is to persuade you to re-consider how you deploy TEE-based applications, if you should deploy them at all.

Trusted hardware companies (Intel, AMD, etc.) mainly compete on performance, functionality and (one hopes) developer-friendliness. They may try to compete on security, but this is hard, in my opinion: there’s always someone else who can (mis)claim more security and such claims are hard to adjudicate by the market. Furthermore, the complexity of modern CPU architectures and the pervasiveness of side-channels makes TEE security claims tenuous.

In any case, (some of) the TEE attacks follow below.

Bugs in the enclave code

Enclaves are meant to protect secrets and integrity of computation from the environment (e.g., host OS, or even the physical environment). But even if the enclave platform is secure, bugs in the code running in the enclave can lead to disaster.

  • Signal’s contact discovery enclave had memory safety issues that allowed the host to confuse it and caused the enclave to leak its own memory contents.

TEE remote attestation forgery bugs

Many of these attacks impacted not only Intel SGX but other TEE platforms as well, like AMD SEV.

  • 2018, Foreshadow: malicious OS can steal Intel SGX attestation key (for the first time!)
  • 2020, SGAxe: needs ring-0 access to steal SGX attestation key (this was the 2nd time!)
  • 2022, ÆPIC Leak: microarchitectural bug allows host root admin to steal SGX attestation key
  • 2024, BadRAM, tampered DIMM SPD chip on AMD SEV-SNP systems
    • A host root admin with one-time physical access (~$10 to reprogram the DIMM) can run a backdoored VM while the genuine AMD chip signs a report attesting to the benign VM (no key is extracted, but the attestation is false).
  • 2025, WireTap.fail, interposition physical attack for DDR4 systems
    • “We have successfully extracted attestation keys, which are the primary mechanism used to determine whether code is running under SGX. This allows any hacker to masquerade as genuine SGX hardware, while in fact running code in an exposed manner and peeking into your data. We demonstrate concrete security breaks on real-world software utilizing SGX, such as Secret Network, Phala, Crust, and IntegriTEE.”
  • 2025, TEE.fail, interposition physical attack for DDR5 systems
  • 2025, Battering RAM, interposition physical attack for DDR4 systems
  • 2026, DDRrop, interposition physical attack for DDR5 systems by dropping writes
    • Intel TDX remote attestation forgery

You may say: “I don’t care; my threat model precludes physical attacks.” No it doesn’t, silly: your remote attestation verifier accepts a quote from any Intel CPU in good standing. And the attacker’s CPU is one of them. A break of one is a break of all, unless…

Unless: you pin your verifier to only accept your own PCK certificates, which implicitly excludes the attacker’s CPU. This works for so-called scalable SGX (the only flavor left) and requires you to carefully manage a PKI. So, effectively requires you to wield a footgun. Good luck!

TEE liveness bugs

DoS is explicitly outside the threat model of SGX, TDX, SEV-SNP and Nitro (b.c. the host can simply refuse to schedule the enclave). So, here, we focus on liveness issues due to issues with the TEE platform itself.

More academic paper attacks

So many$^,$$^,$$^,$.

In theory, there are ways to reduce the attack surface of trusted hardware. For example, see Sanctum from my group at MIT back in the day (shameless plug). Unfortunately, in practice, these more principled designs tend to come with lower performance and/or less functionality.

Conclusion

Don’t put valuable secrets in your TEEs, or they’re likely to become public, especially if physical attacks are in your threat model.

References

For cited works, see below 👇👇

联系我们 contact @ memedata.com