Skip to main content
QUICK REVIEW

[Paper Review] Inferring Fine-grained Control Flow Inside SGX Enclaves with Branch Shadowing

Sangho Lee, Ming-Wei Shih|arXiv (Cornell University)|Nov 21, 2016
Security and Verification in ComputingComputer Science46 references235 citations
TL;DR

The paper presents a branch shadowing side-channel attack that reveals fine-grained control flow inside SGX enclaves by exploiting branch prediction, BTB, and LBR, and proposes mitigations including Zigzagger.

ABSTRACT

In this paper, we explore a new, yet critical, side-channel attack against Intel Software Guard Extension (SGX), called a branch shadowing attack, which can reveal fine-grained control flows (i.e., each branch) of an enclave program running on real SGX hardware. The root cause of this attack is that Intel SGX does not clear the branch history when switching from enclave mode to non-enclave mode, leaving the fine-grained traces to the outside world through a branch-prediction side channel. However, exploiting the channel is not so straightforward in practice because 1) measuring branch prediction/misprediction penalties based on timing is too inaccurate to distinguish fine-grained control-flow changes and 2) it requires sophisticated control over the enclave execution to force its execution to the interesting code blocks. To overcome these challenges, we developed two novel exploitation techniques: 1) Intel PT- and LBR-based history-inferring techniques and 2) APIC-based technique to control the execution of enclave programs in a fine-grained manner. As a result, we could demonstrate our attack by breaking recent security constructs, including ORAM schemes, Sanctum, SGX-Shield, and T-SGX. Not limiting our work to the attack itself, we thoroughly studied the feasibility of hardware-based solutions (e.g., branch history clearing) and also proposed a software-based countermeasure, called Zigzagger, to mitigate the branch shadowing attack in practice.

Motivation & Objective

  • Motivate and assess the security risks of SGX enclaves against fine-grained control-flow leakage beyond coarse page-level attacks.
  • Investigate a new side-channel—branch shadowing—that uses branch prediction history to reveal enclave execution traces.
  • Evaluate the attack against current SGX defenses and propose practical mitigations with measured overheads.

Proposed method

  • Develop a branch shadowing technique that combines BTB with LBR to determine whether target branches inside an enclave were taken and their targets.
  • Use Intel PT timing and LBR elapsed-cycle data to precisely infer branch outcomes with minimal noise.
  • Manipulate execution timing and memory addressing (via APIC timer and cache control) to synchronize victim and shadow code for accurate probing.
  • Align shadow and victim branch addresses in lower address bits to allow BTB collisions and shared prediction state.
  • Probe different branch types (conditional, unconditional, indirect) and interpret LBR and elapsed cycles to infer branch history and targets.
  • Propose mitigations including hardware-based branch history clearing and software-based Zigzagger to mitigate the attack.

Experimental results

Research questions

  • RQ1Can an OS-controlled attacker infer fine-grained control-flow inside SGX enclaves beyond coarse page-level access patterns?
  • RQ2How can BTB and LBR features be leveraged together to reveal branch-level execution traces within enclaves?
  • RQ3What are practical countermeasures to mitigate branch shadowing with acceptable performance overhead?

Key findings

  • The branch shadowing attack can identify fine-grained control flow inside an enclave at the level of basic blocks.
  • Using LBR and Intel PT yields precise branch history information with reduced measurement noise compared to prior timing approaches.
  • The attack can extract sensitive information from SGX applications and bypass several state-of-the-art SGX defenses (e.g., deterministic multiplexing, Sanctum, SGX-Shield, T-SGX).
  • Hardware- and software-based mitigations are feasible with overheads below 1.3x for the proposed approaches.
  • The attack demonstrates both conditional, unconditional, and indirect branch leakage through intact enclave execution traces.

Read this paper

Open the full text in the Nubint reader and ask about any passage as you read.

Read this paper on Nubint

This review was generated by AI from the original paper. Please check the paper before citing it.