BranchCloak
November 4, 2025 · View on GitHub
BranchCloak: Mitigating Side-Channel Attacks on Directional Branch Predictors
Jihoon Kim, Hyerean Jang, and Youngjoo Shin
School of Cybersecurity, Korea University
Published in Electronics 2025, 14(9):1758
https://doi.org/10.3390/electronics14091758
🧩 Overview
BranchCloak is a novel software-based mitigation technique that protects processors from Pattern History Table (PHT) side-channel attacks on directional branch predictors.
Instead of modifying hardware, BranchCloak obfuscates the PHT state by inserting r-branches—randomized dummy conditional branches—that collide with the target branch in the PHT.
This randomization prevents attackers from inferring the branch direction of victim processes.
⚙️ Core Idea
PHT-based attacks (e.g., BranchScope[1], Bluethunder[2]) exploit shared branch predictor state between cores.
BranchCloak neutralizes this by ensuring:
- Each r-branch:
- Occupies the same PHT entry as the target (secret-dependent) branch.
- Makes a random branch decision (50% taken / not-taken).
Even if an attacker probes the PHT, the randomized state reveals no information about the victim’s control flow.
📊 Evaluation
- Tested on Intel Kaby Lake, Comet Lake, Rocket Lake CPUs
- Benchmarks: OpenSSL 3.1.0, MbedTLS 3.1.0, Libgcrypt 1.9.4
- Targeted secret-dependent branches (e.g., RSA modular exponentiation, ECC scalar multiplication)
🛠️ How to
A quick guide to the two top-level experiment folders in this repository.
pht_collision_test/— PoC for PHT side-channel attack and BranchCloak- A compact, pedagogical proof-of-concept that demonstrates:
- PHT entry collision and BranchScope-style 1-bit leakage.
- How BranchCloak inserts aligned r-branches to obfuscate the PHT state.
- A compact, pedagogical proof-of-concept that demonstrates:
realworld/— Real-world vulnerable crypto libraries (evaluation)- Contains prepared testbeds for: Libgcrypt 1.9.4, MbedTLS 3.1.0, and OpenSSL 3.1.0.
- Each library folder includes two build variants (
raw/andalign/) and automation scripts (run.py,run.sh) to compare unprotected vs BranchCloak-protected runs.
[1] Evtyushkin, Dmitry, et al. "Branchscope: A new side-channel attack on directional branch predictor." ACM SIGPLAN Notices 53.2 (2018): 693-707.
[2] Huo, Tianlin, et al. "Bluethunder: A 2-level directional predictor based side-channel attack against sgx." IACR Transactions on Cryptographic Hardware and Embedded Systems (2020): 321-347.