PMUSpill: The Counters in Performance Monitor Unit that Leak SGX-Protected Secrets

Pengfei Qiu, Yongqiang Lyu, Haixia Wang, Dongsheng Wang, Chang Liu, Qiang Gao, Chunlu Wang, Rihui Sun, Gang QuarXiv 2022 · DOI

Introduction

Modern processors utilize transient execution—techniques such as speculative execution and out-of-order processing—to maximize performance. When the processor determines that certain work was unnecessary (e.g., due to a branch misprediction), it rolls back the architectural state (registers and memory) to maintain correctness. While previous vulnerabilities like Spectre and Meltdown demonstrated that this "invisible" work leaves traces in the CPU cache, it was widely assumed that Performance Monitor Units (PMUs)—hardware modules used to count microarchitectural events—would either ignore transient events or roll back their counters.

PMUSpill challenges this assumption. Researchers have identified that certain PMU counters fail to roll back during transient execution, creating a "spill" of information from secure environments, such as Intel SGX, to an attacker. This discovery reveals a significant gap in hardware security models where performance monitoring inadvertently leaks sensitive data.

Methodology: The PMUSpill Attack

The PMUSpill attack follows a four-step procedure designed to extract secrets from a victim enclave by exploiting non-atomic PMU updates.

Overview of the PMUSpill attack procedure against an Intel SGX enclave.
  1. Baseline: The attacker reads the initial value of a specific PMU counter.
  2. The Gadget: The attacker executes a "transient execution gadget." This gadget triggers a sequence where a secret value, loaded from an SGX enclave, determines the execution path.
  3. The Trigger: Each path is designed to trigger a specific PMU event (e.g., a stall or TLB miss). Because the PMU fails to roll back, the counter increments even if the instructions are eventually discarded by the processor.
  4. Recovery: The attacker reads the PMU counter again. A change in the counter indicates which path was taken, allowing the attacker to infer the secret data.

To identify vulnerable counters, the researchers systematically analyzed the uops.info dataset, testing thousands of X86 instructions against 217 valid PMU counters on Intel Skylake processors.

Key Insights

The core discovery of PMUSpill is the "Non-Atomic" PMU. While the CPU's architectural state is atomic, PMU updates are often decoupled from the instruction retirement process, recording events as they occur in the pipeline. The researchers identified 20 vulnerable channels across different PMU counters, including branch misprediction counters and execution stall cycles.

A critical aspect of the attack is the ability to encode secret data as execution paths. By using a secret as an index to decide between a "hit" or "miss" in a transiently executed branch, attackers can reliably leak information. Furthermore, although reading PMU counters typically requires root privileges, the attack remains a critical threat to Trusted Execution Environments (TEEs) like SGX, which are designed to protect data even from a compromised Operating System.

Results and Impact

The researchers successfully implemented a real-world attack to leak secrets from an Intel SGX enclave with high efficiency:

  • High Throughput: PMUSpill achieved a leakage rate of 575.3 bytes per second (Bps).
  • High Accuracy: The attack maintained an error rate of less than 2% on average.

These results demonstrate that PMU-based side channels are a viable and potent threat to hardware-based security primitives.

Conclusion and Future Work

PMUSpill highlights a fundamental design flaw in modern PMUs. To mitigate this, hardware designers should consider "renaming" PMU counters or integrating them into the reorder buffer so they only update upon successful instruction retirement.

While the current research focuses on Intel architectures and requires root access, future work will explore similar vulnerabilities in ARM and AMD processors. Additionally, investigating more complex instruction sequences as triggers could potentially reveal deeper internal processor states, further expanding the scope of PMU-based leakage.

Summary updated

BibTeX
@misc{qiu2022pmuspill,
  author = {Pengfei Qiu and Yongqiang Lyu and Haixia Wang and Dongsheng Wang and Chang Liu and Qiang Gao and Chunlu Wang and Rihui Sun and Gang Qu},
  title = {{PMUSpill: The Counters in Performance Monitor Unit that Leak SGX-Protected Secrets}},
  year = {2022},
  eprint = {2207.11689},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2207.11689},
}
Figure