Lune

CCS2026Top-tier venue

Branch Target Reuse: Practical Spectre-v2 Attacks in JIT Engines via Stale Branch Prediction Entries

Sander Wiebing, Yuhui Zhu, Alessandro Biondi, Cristiano Giuffrida

Abstract

Self-Modifying Code (SMC) is the foundation of dynamic code generation in commodity JIT engines. Modern processors provide coherence mechanisms that ensure stale, overwritten code cannot be executed architecturally, but their guarantees during microarchitectural execution remain less understood. The only previously known SMC-based transient execution primitive (SCSB), is limited to x86 and relies on a very short instruction/data-cache coherence window, shaping the common view that SMC-based transient execution attacks are impractical in real-world JIT engines. In this paper, we overturn this assumption and introduce Branch Target Reuse (BTR), the first practical in-place Spectre-v2 attack. The key insight is that, while modern CPUs restore architectural code coherence after self-modification, they do not necessarily invalidate stale indirect branch prediction entries (i.e., branch targets ). In JIT engines, these stale targets can outlive the original code and later be reused when the code cache is repopulated, yielding a transient execute-after-free primitive. This allows attackers to hijack transient control flow to newly generated code at obsolete offsets, bypassing software hardening or reaching misaligned gadgets. We evaluate across SpiderMonkey, GraalVM, and the Linux kernel's cBPF JIT, and show that it is a cross-engine issue whose exploitability depends on code-cache management and garbage-collection noise. Focusing on the most vulnerable target, cBPF, we build two end-to-end exploits against the Linux kernel that leak the root password hash in minutes on Intel systems despite deployed mitigations and even when enabling cBPF's constant blinding defense.

Ask Lune

Know where this paper stands in minutes, not an afternoon.

Lune can read the top-tier papers that cite it and the ones closest to it, and tells you what it claims, what came after and where it falls short, each point cited to the paper it comes from. No skimming, no AI slop.

Questions to start from

Lune can draw on

its abstract · related work

Get the answer

Free to start. No credit card required.

Related papers

  1. Breaking the Barrier: Post-Barrier Spectre AttacksJohannes Wikner, Kaveh RazaviS&P 2025
  2. RETBLEED: Arbitrary Speculative Code Execution with Return InstructionsJohannes Wikner, Kaveh RazaviUSENIX Security 2022
  3. Training Solo: On the Limitations of Domain Isolation Against Spectre-v2 AttacksSander Wiebing, Cristiano GiuffridaS&P 2025
  4. Rage Against the Machine Clear: A Systematic Analysis of Machine Clears and Their Implications for Transient Execution AttacksHany Ragab, Enrico Barberis, Herbert Bos, Cristiano GiuffridaUSENIX Security 2021 · 76 citations
  5. VMSCAPE: Exposing and Exploiting Incomplete Branch Predictor Isolation in Cloud EnvironmentsJean-Claude Graf, Sandro Rüegge, Ali Hajiabadi, Kaveh RazaviS&P 2026 · 4 citations
Dusk over the sea between two cliffs drawn in fine vertical lines