Take A Way: Exploring the Security Implications of AMD's Cache Way Predictors

Moritz Lipp, Vedad Hadzic, Michael Schwarz, Arthur Perais, Clémentine Maurice, Daniel GrussAsiaCCS 2020

TL;DR

This paper reveals a new class of side-channel attacks targeting AMD's L1D cache way predictors, which are designed to improve performance and reduce power consumption. The authors successfully reverse-engineered these predictors, leading to two novel attack techniques, "Collide+Probe" and "Load+Reload," that can monitor memory accesses and break security mechanisms like ASLR, even in sandboxed environments.

What Problem Does This Paper Address?

Modern CPUs employ various optimizations like out-of-order execution and speculative execution to boost performance. While beneficial, these features can inadvertently create security vulnerabilities. Cache attacks, which exploit timing differences in memory access, have been a significant area of research. However, many existing cache attacks rely on specific architectural features (like inclusive last-level caches or shared memory) that are not always present, particularly in AMD processors. AMD's L1D cache way predictor, introduced to optimize power consumption by predicting which "way" (a block within a cache set) a memory line will be in, presents a new potential attack surface. This paper addresses the lack of understanding and exploitation of this specific AMD microarchitectural feature for security purposes.

Methods

The core of this research involves reverse-engineering AMD's L1D cache way predictor. The authors achieved this by:

  • µTag Collisions: They identified that if two different virtual addresses map to the same cache set and produce the same "µTag" (a hashed representation of the virtual address used by the predictor), accessing one can cause a conflict when the other is accessed later. This conflict leads to an L1D cache miss, forcing a slower access from the L2 cache.
  • Equation System and SMT Solver: By observing these collisions across many virtual addresses, they constructed a system of linear equations over GF(2). Using an SMT solver (Z3), they were able to deduce the specific hash function used by the way predictor to generate the µTag from the virtual address.
  • Collide+Probe Attack: This technique leverages µTag collisions. An attacker uses a known virtual address that shares a µTag with a victim's address. By accessing their own address, the attacker "marks" the way predictor. If the victim then accesses their corresponding address, the way predictor is updated, causing the attacker's subsequent access to miss in the L1D cache, revealing the victim's access. This attack does not require physical addresses or shared memory.
  • Load+Reload Attack: This attack exploits aliased addresses (different virtual addresses mapping to the same physical address). Accessing an aliased address forces a load from L2, making the corresponding cache line inaccessible in L1D for a sibling thread. This allows monitoring of memory accesses on a sibling thread without invalidating the cache line across the entire hierarchy.

Datasets

Not discussed in the paper. The experiments were conducted on various AMD CPUs and in different software environments (Linux kernel, virtual machines, JavaScript).

Key Insights and Ideas

  • Way Predictors as an Attack Surface: The paper demonstrates that performance optimizations like cache way prediction can be a significant security vulnerability.
  • µTag Collisions are Powerful: The ability to induce and detect µTag collisions is the foundation for novel side-channel attacks that bypass traditional defenses.
  • No Physical Addresses Needed: Collide+Probe's ability to work solely with virtual addresses is a significant advantage over many existing cache attacks.
  • Sibling Thread Attacks: Load+Reload shows that even without shared memory, attacks can be mounted on sibling threads sharing a physical core.
  • Universality of the Hash Function: The reverse-engineered hash function appears to be consistent across a wide range of AMD microarchitectures, making the attacks broadly applicable.

Key Results

  • Novel Attack Techniques: Two new side-channel attacks, Collide+Probe and Load+Reload, were developed and demonstrated.
  • High-Speed Covert Channel: A covert channel with a transmission rate of up to 588.9 kB/s was established, outperforming previous state-of-the-art.
  • ASLR Break: Kernel ASLR (KASLR) was broken on a fully patched Linux system, reducing its entropy significantly. User-space ASLR, hypervisor ASLR, and even ASLR from JavaScript were also weakened.
  • Spectre Attack Integration: Collide+Probe was used as a covert channel within a Spectre attack to exfiltrate kernel data.
  • AES Key Recovery: A key recovery attack on a vulnerable AES T-table implementation was demonstrated.
  • Broad CPU Support: The attacks were evaluated on a range of AMD CPUs from K8 (2013) to Zen 2 (2019), confirming the wide applicability of the findings.

Limitations and Future Work

  • Sibling Thread Limitation for Covert Channel: The Collide+Probe covert channel is limited to processes running on the same logical core, as collisions between sibling threads were not observed.
  • Noise Sensitivity: The attacks can be susceptible to noise, requiring error correction or averaging techniques for reliable measurements.
  • Timing Precision: Collide+Probe requires higher timing precision than some other cache attacks.
  • Future Work: The authors suggest exploring more robust protocols for error correction in covert channels, investigating further interactions between way predictors and other CPU features (like transient execution), and developing more comprehensive hardware and software countermeasures. They also propose mapping secret data to multiple virtual addresses with different µTags as a software-only mitigation.

Summary updated

BibTeX
@inproceedings{lipp2020take,
  author = {Moritz Lipp and Vedad Hadzic and Michael Schwarz and Arthur Perais and Clémentine Maurice and Daniel Gruss},
  title = {{Take A Way: Exploring the Security Implications of AMD's Cache Way Predictors}},
  booktitle = {AsiaCCS},
  year = {2020},
  doi = {10.1145/3320269.3384746},
}
Figure