You Cannot Always Win the Race: Analyzing mitigations for branch target prediction attacks
Alyssa Milburn, Ke Sun, Henrique Kawakami · 2023
Many recent attacks such as Branch Target Injection (BTI, aka Spectre v2) take advantage of speculative execution in modern processors, and in particular the inherent race condition between transient execution of code at the predicted target of a branch and the architectural resolution of the branch. This can create a speculation window in which code can be transiently executed at an unintended target, and mitigations for these attacks often focus on minimizing or removing such windows. By investigating the potential sources of latency that may contribute to such a speculation window, such as pipeline contention and simultaneous multithreading (SMT) activity, we show that an attacker can "win the race" despite the adoption of widely-used mitigations, on a variety of different x86 CPUs. We also show that such speculation windows may be present for predictions of direct branches. This enables a new class of BTI-style attacks that do not depend on indirect branches, and bypass the majority of previous mitigations against such attacks.