MACTA: A Multi-agent Reinforcement Learning Approach for Cache Timing Attacks and Detection

Jiaxun Cui, Xiaomeng Yang, Mulong Luo, Geunbae Lee, Peter Stone, Hsien-Hsin S. Lee, Benjamin Lee, G. Edward Suh, Wenjie Xiong, Yuandong TianICLR 2023

Introduction

Security vulnerabilities in modern computer systems raise serious concerns, especially as these systems process an unprecedented amount of private and sensitive data. Researchers have developed MACTA, a multi-agent reinforcement learning (MARL) framework that treats cache timing attacks and their detection as a competitive game. By training "attacker" and "detector" agents against each other in a realistic simulator, the system automatically discovers sophisticated attack strategies and highly robust defenses that outperform traditional, human-designed heuristics.

The Threat of Cache Timing Attacks

Modern processors use "caches"—small, fast memory buffers—to speed up data access. However, because different programs share these caches, a malicious "attacker" can observe how long it takes to access their own data to infer what a "victim" program is doing. These are known as Cache Timing Attacks (CTA), and they can be exploited to steal encryption keys or private data.

Illustration of a Prime+Probe Cache Timing Attack

Traditionally, defending against CTAs is a manual game of whack-a-mole. Security experts design detectors based on specific, known attack patterns (heuristics). This approach is inherently brittle: as soon as a new, slightly different attack is invented, the old detector fails. The authors address this vulnerability by asking: Can we automate the discovery of both attacks and defenses using AI?

Methods: Automating the Arms Race

To move beyond manual heuristics, the authors introduce two major components:

  1. MA-AUTOCAT: A realistic, multi-agent "gym" environment based on a cache simulator. It models four distinct roles: Benign programs, Victims, Attackers, and Detectors.
  2. MACTA (Multi-Agent Reinforcement Learning for CTA): The core training algorithm. It combines three powerful concepts:
  3. Proximal Policy Optimization (PPO): A standard reinforcement learning algorithm used to train the agents' policies.
  4. Fictitious Play (FP): Instead of just training an attacker against the latest detector, agents are trained against a pool of all previous versions of their opponents. This prevents "cyclic" behavior, where an agent forgets how to beat an old strategy while learning a new one.
  5. Transformer Encoders: The agents use Transformer architectures to process sequences of memory accesses, allowing them to spot long-term patterns that simpler models often miss.

Evaluation and Datasets

The researchers evaluated MACTA using a combination of simulated and real-world data:

  • SPEC 2017 Benchmark Suite: Memory access traces from these standard industry benchmarks were used to represent "benign" (non-malicious) program behavior.
  • MA-AUTOCAT Traces: The primary evaluation occurred within their newly created simulator, which generates realistic cache hit/miss data.
  • Real Hardware Traces: To prove their results could bridge the "sim-to-real" gap, they validated attack sequences on commercial Intel i7-6700 (SkyLake) and i7-7700k (KabyLake) processors.

Key Insights

  • The Power of Population-Based Training: By maintaining a "pool" of historical opponents, the MACTA detector learns a generalized defense that avoids overfitting to any single specific attack.
  • Transformers are Essential: The study found that standard Multi-Layer Perceptrons (MLPs) failed to learn effective policies. Because CTAs are essentially sequence-modeling problems (patterns over time), the attention mechanism in Transformers proved to be the "secret sauce" for success.
  • Strategic Obfuscation: The MACTA attacker learned to "mimic" benign programs—inserting random delays and dummy accesses—to lower its "bandwidth" and stay under the detector's radar.

Primary Results

The empirical results demonstrate that MACTA is an effective solution that requires no manual input from security experts:

  • Generalization: The MACTA detector achieved a 97.8% detection rate on human-designed attacks (like Prime+Probe) even though it was never specifically trained on them.
  • Evasion: The MACTA attacker proved incredibly stealthy, achieving up to a 99% evasion rate against Cyclone, a previous state-of-the-art SVM-based detector.
  • Efficiency: When facing an adaptive RL-based attacker, the MACTA detector forced the attacker to reduce its "attack bandwidth" (the speed of data theft) by 20% on average to avoid being caught.
  • Hardware Transfer: Attack sequences discovered in the simulator transferred to real Intel hardware with >99% accuracy, proving the simulator's practical utility.

Limitations and Future Work

While promising, the approach has limitations. Deployment Overhead is a primary concern: while the attacker can run on any system, deploying a Transformer-based detector inside a physical CPU would require dedicated hardware changes and could introduce power and area overhead. Additionally, the authors noted a "Forgetting" Problem, where detectors sometimes slightly lose their ability to generalize as training progresses, suggesting that managing the diversity of the opponent pool is a tricky balancing act. Finally, the current study focuses on scenarios with one attacker and one victim; future work will need to explore more complex environments with multiple interleaved benign programs and attackers.

Summary updated

BibTeX
@inproceedings{cui2023macta,
  author = {Jiaxun Cui and Xiaomeng Yang and Mulong Luo and Geunbae Lee and Peter Stone and Hsien-Hsin S. Lee and Benjamin Lee and G. Edward Suh and Wenjie Xiong and Yuandong Tian},
  title = {{MACTA: A Multi-agent Reinforcement Learning Approach for Cache Timing Attacks and Detection}},
  booktitle = {International Conference on Learning Representations},
  year = {2023},
  url = {https://openreview.net/forum?id=CDlHZ78-Xzi},
}
Figure