Exceptions are a commodity hardware functionality which is central to multi-tasking OSes as well as event-driven user applications. Normally, the OS assists the user application by lifting the semantics of exceptions received from hardware to program-friendly user signals and exception handling interfaces. However, can exception handlers work securely in user enclaves, such as those enabled by Intel SGX, where the OS is not trusted by the enclave code? In this paper, we introduce a new attack called SmashEx which exploits the OS-enclave interface for asynchronous exceptions in SGX. It demonstrates the importance of a fundamental property of safe atomic execution that is required on this interface. In the absence of atomicity, we show that asynchronous exception handling in SGX enclaves is complicated and prone to re-entrancy vulnerabilities. Our attacks do not assume any memory errors in the enclave code, side channels, or application-specific logic flaws. We concretely demonstrate exploits that cause arbitrary disclosure of enclave private memory and code-reuse (ROP) attacks in the enclave. We show reliable exploits on two widely-used SGX runtimes, Intel SGX SDK and Microsoft Open Enclave, running OpenSSL and cURL libraries respectively. We tested a total of 14 frameworks, including Intel SGX SDK and Microsoft Open Enclave, 10 of which are vulnerable. We discuss how the vulnerability manifests on both SGX1-based and SGX2-based platforms. We present potential mitigation and long-term defenses for SmashEx.
翻译:商品硬件功能是多任务操作系统以及事件驱动用户应用程序的核心。 通常, OS 协助用户应用, 取消从硬件到程序友好用户信号和例外处理界面的例外的语义。 但是, 例外处理者可以在用户飞地安全工作, 例如英特尔 SGX 促成的, 飞地代码不信任操作系统? 在本文中, 我们引入了名为 SmashEx 的新攻击, 利用OS- 增强的平台平台, 使SGX 出现不同步的例外。 它展示了从硬件到程序友好用户信号和例外处理界面所需的安全原子执行的基本特性。 但是, 在缺乏原子特性的情况下, 我们显示, SGX 飞地处理的不连贯例外处理非常复杂, 容易再次进入脆弱性。 我们的攻击并不假定飞地代码、 侧端频道或应用程序特有的逻辑缺陷有任何记忆错误。 我们具体展示了导致飞地个人记忆和代码应用平台(ROPX) 的任意披露。 它显示了安全原子执行的重要性。 在飞地、 OSSG 和SDL 上, 我们分别对SD-K 的开放SD- 和SD- 测试了两个SD-K 框架进行了可靠的探索。