[Paper Review] Malware Guard Extension: Using SGX to Conceal Cache Attacks
This paper demonstrates the first practical cache side-channel attack from within a malicious Intel SGX enclave, bypassing SGX's isolation to extract 96% of a 4096-bit RSA private key from a single trace and the full key in 11 traces within 5 minutes. The attack exploits DRAM and cache side channels without timers, large pages, or physical addresses, leveraging SGX's own security features to conceal the malware.
In modern computer systems, user processes are isolated from each other by the operating system and the hardware. Additionally, in a cloud scenario it is crucial that the hypervisor isolates tenants from other tenants that are co-located on the same physical machine. However, the hypervisor does not protect tenants against the cloud provider and thus the supplied operating system and hardware. Intel SGX provides a mechanism that addresses this scenario. It aims at protecting user-level software from attacks from other processes, the operating system, and even physical attackers. In this paper, we demonstrate fine-grained software-based side-channel attacks from a malicious SGX enclave targeting co-located enclaves. Our attack is the first malware running on real SGX hardware, abusing SGX protection features to conceal itself. Furthermore, we demonstrate our attack both in a native environment and across multiple Docker containers. We perform a Prime+Probe cache side-channel attack on a co-located SGX enclave running an up-to-date RSA implementation that uses a constant-time multiplication primitive. The attack works although in SGX enclaves there are no timers, no large pages, no physical addresses, and no shared memory. In a semi-synchronous attack, we extract 96% of an RSA private key from a single trace. We extract the full RSA private key in an automated attack from 11 traces within 5 minutes.
Motivation & Objective
- To investigate whether cache side-channel attacks are feasible from within an SGX enclave despite hardware restrictions.
- To demonstrate that SGX enclaves can host undetectable malware capable of extracting secrets from co-located enclaves.
- To develop a timing mechanism accurate enough to perform side-channel attacks without access to the timestamp counter.
- To overcome the absence of physical addresses and large pages in SGX by combining DRAM and cache side channels.
- To evaluate the effectiveness of the attack on a real-world, constant-time RSA implementation (mbedTLS) under realistic isolation conditions.
Proposed method
- Developed a novel timing measurement technique using CPU cycle counting and cache access patterns, achieving higher accuracy than the native timestamp counter.
- Combined DRAM and cache side channels to recover physical address bits without relying on 2 MB pages or physical address exposure.
- Implemented a Prime+Probe attack on a co-located SGX enclave running mbedTLS’s constant-time RSA implementation.
- Used randomization of cache set assignments to infer correct cache set accesses despite OS-level cache set bias.
- Automated key recovery by analyzing multiple traces and reconstructing the RSA private key from observed cache access patterns.
- Leveraged SGX’s hardware encryption and isolation to hide the malware from the OS and detection mechanisms, including performance counters.
Experimental results
Research questions
- RQ1Can cache side-channel attacks be mounted from within an SGX enclave despite the absence of timers, physical addresses, and shared memory?
- RQ2To what extent can DRAM side-channel information be used to recover physical address bits in the absence of large pages?
- RQ3Can timing measurements be performed with sufficient accuracy in SGX without access to the timestamp counter?
- RQ4Is it possible to extract cryptographic keys from a co-located enclave using only side-channel information, even when the target uses constant-time implementations?
- RQ5Can such an attack remain undetected by the operating system and hardware monitoring tools, including performance counters?
Key findings
- The attack successfully extracted 96% of a 4096-bit RSA private key from a single Prime+Probe trace on a co-located SGX enclave.
- Full RSA private key recovery was achieved from only 11 traces within 5 minutes using an automated attack pipeline.
- The timing measurement technique achieved higher accuracy than the native timestamp counter, enabling precise side-channel analysis.
- The attack remained undetectable by the operating system and could not be observed via performance counters, as Intel intentionally excludes SGX activity from these counters.
- The method successfully recovered physical address bits without relying on 2 MB pages or direct physical address access, using a combination of DRAM and cache side channels.
- The attack was effective even when the target enclave ran in a Docker container, demonstrating that containerization does not prevent enclave-to-enclave side-channel attacks.
Read this paper
Open the full text in the Nubint reader and ask about any passage as you read.
Read this paper on NubintThis review was generated by AI from the original paper. Please check the paper before citing it.