TL;DR
SpectreRSB is a new class of speculative execution attacks that targets the Return Stack Buffer (RSB) rather than the traditional branch predictor unit. By exploiting how modern CPUs predict return addresses, this attack successfully bypasses major defenses like Google’s Retpoline and Intel’s microcode patches, even compromising secure Intel SGX enclaves.
What Problem Does This Paper Address?
Since the disclosure of Spectre and Meltdown, the security community has scrambled to patch speculative execution vulnerabilities. Most efforts have focused on the Branch Predictor Unit (BPU), which guesses the direction of conditional branches (if-statements) and the targets of indirect jumps.
However, modern CPUs use another specialized structure called the Return Stack Buffer (RSB) to predict the destination of ret (return) instructions. The authors identified a critical gap: while we were busy patching the BPU, the RSB remained a wide-open vector for side-channel attacks. Crucially, some popular defenses like Retpoline actually replace indirect jumps with returns to avoid BPU-based attacks, ironically making the system more dependent on the RSB and potentially increasing the attack surface for SpectreRSB.
Methods
The researchers first reverse-engineered the behavior of the RSB on Intel Haswell and Skylake processors. They identified four primary ways to trigger misspeculation through the RSB:
- Overfill/Underfill (S1): Pushing more calls than the hardware stack can hold (typically 16 entries), causing older entries to be overwritten.
- Direct Pollution (S2): Manually manipulating the software stack so it no longer matches the hardware RSB.
- Speculative Pollution (S3): Using speculatively executed calls to push malicious addresses onto the RSB.
- Context Switch Pollution (S4): Exploiting the fact that the RSB is shared across hardware threads on the same core.
To demonstrate the threat, they developed several Proof-of-Concept (PoC) attacks:
- Intra-process: Reading memory the process shouldn't access within its own address space.
- Cross-thread: One thread polluting the RSB to attack a victim thread on the same physical core.
- SGX Attack: A malicious OS polluting the RSB to force an SGX enclave to speculatively execute a "gadget" that leaks secret data.
- User-to-Kernel: Attempting to leak kernel data from user space.
Datasets
The authors evaluated their attacks on two primary hardware setups:
- Machine 1: Intel Xeon(R)-E51620 running Linux kernel 4.15.0-22-generic (patched with Retpoline and KPTI).
- Machine 2: Intel Core(TM)-i7-6700 (Skylake) running Linux kernel 4.4.117 (patched with Retpoline, KPTI, and RSB refilling).
Key Insights and Ideas
- The Retpoline Irony: Retpoline was designed to stop Spectre V2 by turning indirect jumps into returns. SpectreRSB turns this defense into a liability by attacking the very mechanism Retpoline relies upon.
- RSB Sharing: Because the RSB is shared between hardware threads (Hyper-Threading), an attacker can "poison" the stack of a victim process running on the same core.
- SGX Vulnerability: Intel SGX enclaves are particularly vulnerable because they share the same address space and hardware structures as the untrusted host process. The authors found that SpectreRSB bypasses all current SGX protections.
- Mismatch is Key: The attack works by creating a discrepancy between the hardware RSB and the software stack. When the CPU executes a
ret, it speculatively jumps to the (attacker-controlled) address in the RSB while waiting for the "real" address to be fetched from memory.
Key Results
- SGX Compromised: The attack successfully leaked data from SGX enclaves on fully patched machines, bypassing Retpoline and Intel's microcode updates.
- Cross-Thread Success: The researchers demonstrated a practical attack where two colluding threads could leak data, proving that RSB pollution persists across context switches.
- Defense Evasion: Table 2 in the paper highlights that while "RSB refilling" (a patch for Skylake+) stops some kernel-switch attacks, it does not protect against same-privilege or SGX-based SpectreRSB attacks.
- Xeon Vulnerability: Many server-class Xeon processors do not implement RSB refilling, leaving them highly vulnerable to cross-context attacks.
Limitations and Future Work
- SMEP/SMAP Hurdles: Supervisor Mode Execution Prevention (SMEP) makes user-to-kernel attacks difficult because the CPU won't speculatively jump from kernel mode to user-mode code.
- Synchronization: Cross-process attacks (Attack 2c) are theoretically possible but difficult to synchronize in practice; the authors did not provide a full PoC for this specific variant.
- Future Defenses: The authors recommend that "RSB refilling" (clearing/stuffing the RSB on context switches) be deployed universally, not just on newer Intel chips. However, they admit this is an ad hoc fix and argue for future CPU designs that physically separate speculative data from committed state.
Summary updated