Ghost Thread: Effective User-Space Cache Side Channel Protection

Robert Brotzman, Danfeng Zhang, Mahmut T. Kandemir, Gang Tan

Introduction

Modern CPU architectures often share physical resources, such as the Last-Level Cache (LLC), across multiple processes. While efficient, this sharing introduces significant security vulnerabilities. Attackers can exploit these shared caches using techniques like Prime+Probe or Flush+Reload to observe a victim program's memory access patterns. If these patterns correlate with secret data, such as cryptographic keys, the attacker can extract sensitive information.

Existing defenses typically fall into three categories: hardware modifications, OS/hypervisor changes, or constant-time programming. However, these are often difficult to deploy, require specialized hardware, or impose significant performance penalties. This paper presents Ghost Thread, a lightweight, user-space library designed to thwart cache side-channel attacks on commodity hardware with minimal overhead.

System Design and Implementation

Ghost Thread operates on the principle of noise injection. Instead of attempting to isolate the cache—a complex task requiring hardware or OS support—it buries the victim's true access patterns under a mountain of synthetic noise.

Developers integrate the library by identifying sensitive memory regions (e.g., an AES S-box) and wrapping the relevant code with Ghost Thread API calls. When the application enters a sensitive section, it spawns "protection threads" that concurrently access memory addresses within the target region.

Sequence diagram illustrating the lifecycle of Ghost Threads and their interaction with the main program execution.

By pinning these protection threads to separate CPU cores and assigning them high scheduling priority, Ghost Thread ensures that noise generation happens in parallel with the victim's execution. This concurrent approach avoids the high latency overhead associated with inlining noise directly into the main execution thread.

Security Evaluation

The primary goal of Ghost Thread is to make side-channel attacks computationally infeasible. The authors demonstrate that the number of samples an attacker must collect to distinguish the real signal from the injected noise grows exponentially with the amount of noise.

In tests against an AES implementation in libgcrypt, Ghost Thread increased the required sample count by a factor of $10^{26}$. At current hardware speeds, successfully extracting a key would take approximately $10^{17}$ years.

Comparison of cache hit rates for AES key guesses. The unprotected version shows a clear spike at the real key, while the Ghost Thread-protected version flattens the signal, making the key indistinguishable.

Performance and Real-World Impact

The library was evaluated using the Apache web server and standard cryptographic libraries. Because most applications spend only a small fraction of their time (often <0.5%) in sensitive code sections, the overall system overhead remains remarkably low.

On an Apache server under varying loads, the overhead ranged from negligible to a maximum of 20.1%. This significantly outperforms hardware-transactional memory defenses like Cloak, which can reach overheads of 248%. Even in synthetic worst-case scenarios with high background system load, Ghost Thread's overhead remained between 13% and 35%.

Conclusion and Future Work

Ghost Thread provides a practical, deployable defense against cache side-channel attacks without requiring hardware or OS modifications. While it does not theoretically eliminate the side channel, it renders exploitation practically impossible. Future improvements could involve automating the identification of sensitive memory regions through advanced static analysis, further reducing the burden on developers.

Summary updated

BibTeX
@inproceedings{brotzman2021ghost,
  author = {Robert Brotzman and Danfeng Zhang and Mahmut T. Kandemir and Gang Tan},
  title = {{Ghost Thread: Effective User-Space Cache Side Channel Protection}},
  booktitle = {CODASPY},
  year = {2021},
  doi = {10.1145/3422337.3447846},
}
Figure