Leaking Secrets through Modern Branch Predictor in the Speculative World
Md Hafizul Islam Chowdhuryy, Fan Yao · IEEE Transactions on Computers · 2021
Transient-execution attacks that exploit speculation have raised significant concerns in computer systems. Typically, branch-predictors are leveraged to trigger mis-speculation in transient-execution attacks. In this work, we demonstrate a new class of speculation-based attack that targets branch-prediction unit. We find that speculative resolution of conditional branches alter the states of pattern-history table in modern processors, which are not restored after the corresponding branches are later squashed. Such characteristic allows attackers to exploit BPU as the secret transmitting-medium in transient-execution attacks. To evaluate the discovered vulnerability, we build a novel attack-framework, BranchSpectre, that enables unintended secrets exfiltration through observing speculative PHT updates. We further investigate PHT-collision mechanism in the history-based predictor as well as the branch-prediction mode transitions in Intel processors. We implement a covert-channel (BranchSpectre-cc) and two side channels (BranchSpectre-v1 and BranchSpectre-v2) that rely on BPU for mis-speculation trigger and secret inference in the speculative domain. Notably, BranchSpectre side channels take advantage of much simpler code patterns than the ones used in Spectre attacks. We present an extensive BranchSpectre code gadget analysis on several popular real-world application code-bases followed by a demonstration of real-world side-channel attack on OpenSSL. Finally, we discuss secure branch prediction mechanisms that can mitigate transient execution attacks.