Modified Cache Template Attack on AES

Mahdi Esfahani, Hadi Soleimany, Mohammad Reza ArefIACR ePrint 2020

Abstract

Cache Template Attacks (CTA) provide a powerful framework for automating the discovery of side-channel vulnerabilities in cryptographic implementations. However, the profiling phase of these attacks—which involves scanning memory for exploitable addresses—is traditionally slow and computationally expensive. This paper presents a modified profiling algorithm that utilizes a "skip and trace-back" strategy to locate AES T-tables. By exploiting the sparsity of leaking addresses in memory, the proposed method achieves a 64x speedup, reducing profiling time from approximately 11 minutes to under 10 seconds while maintaining high accuracy in secret key retrieval.

Introduction

Side-channel attacks represent a significant threat to modern cryptography by targeting the physical implementation of algorithms rather than their mathematical complexity. Among these, CPU cache timing attacks are particularly potent. By observing the timing differences between fast cache hits and slower main memory fetches, an attacker can infer the data being processed by a victim application.

While techniques like "Flush+Reload" are highly effective, they often require an attacker to have prior knowledge of which specific memory addresses (such as AES T-tables) are leaking information. Cache Template Attacks (CTA) were introduced to automate this discovery process. However, the standard profiling phase of a CTA is a bottleneck; it typically performs an exhaustive linear scan of every 64-byte cache line within a library (e.g., OpenSSL) to identify correlations between cache hits and secret keys. This paper addresses this inefficiency, making automated cache attacks more practical for real-world scenarios.

Methodology: The "Skip and Trace-Back" Algorithm

The authors propose a Modified Profiling Phase that replaces the exhaustive linear scan with a two-step search heuristic designed to find the "loud" exploitable areas of memory more efficiently.

1. The Baseline (Standard CTA)

The original method tests every cache line (64 bytes) sequentially. For each address, it executes hundreds of encryptions to determine if there is a statistically significant correlation between the secret key and the cache state. In a large binary like libcrypto.so, this process is redundant and time-consuming.

The modified approach relies on the insight that exploitable information is sparse, but the targets (T-tables) are relatively large (1024 bytes).

  • Step 1: The Leap (Coarse Search): Instead of checking every 64 bytes, the algorithm "jumps" forward by a large distance $d$ (e.g., 4096 bytes). It monitors for any indication of a high cache-hit ratio. Because the T-tables occupy a significant contiguous block of memory, a large stride is likely to land within or near a table eventually.
  • Step 2: The Refinement (Fine Search): Once a high-hit area is identified, the algorithm traces backward in standard 64-byte increments to locate the exact starting address of the T-table.

By bypassing the vast majority of "quiet" memory regions where no leakage occurs, the attacker can focus computational resources on the relevant sections of the binary.

Experimental Setup

The effectiveness of the modified attack was evaluated in a controlled systems environment:

  • Target Library: OpenSSL version 1.1.0f (utilizing T-table-based AES).
  • Operating System: Ubuntu 16.04.
  • Hardware: Intel Core i5-2.50 GHz processor, utilizing its shared, inclusive L3 cache.
  • Attack Mechanism: A modified version of the Flush+Reload cache attack.

Key Results and Performance

The modified attack demonstrated a massive performance improvement over the original CTA across various encryption counts ($N$):

  • Significant Speedup: For a standard profile using 1,000 encryptions, the original linear attack required 681.9 seconds (~11 minutes). The modified attack, using a jump distance of 4096 bytes, completed the same task in just 9.8 seconds.
  • Linear Scaling: The speedup factor was found to be approximately $d/64$. As the jump distance $d$ increased from 1024 to 4096 bytes, the attack speed increased by factors of 16x, 32x, 48x, and 64x, respectively.
  • Reliability: Despite the drastic reduction in search time, the method remained highly effective at retrieving the most significant bits (MSBs) of the AES secret key bytes, proving that efficiency does not come at the cost of accuracy.

Discussion and Limitations

While the modified profiling phase significantly lowers the barrier for automated side-channel attacks, it faces certain limitations:

  • Implementation Dependency: This attack specifically targets T-table-based implementations of AES. Modern cryptographic libraries are increasingly moving toward "constant-time" implementations or utilizing hardware-accelerated instructions (such as Intel's AES-NI) to mitigate cache-based leakage.
  • Architectural Requirements: The Flush+Reload mechanism requires an inclusive Last Level Cache (LLC), where data in the L1/L2 caches must also reside in the L3 cache. While common in Intel architectures, this is not universal across all CPU designs.

Conclusion

By shifting from an exhaustive search to a targeted "leap and refine" strategy, the authors have demonstrated that the profiling phase of Cache Template Attacks can be accelerated by two orders of magnitude. This advancement makes it feasible to deploy automated side-channel attacks dynamically, even in rapidly changing environments like cloud or cross-VM scenarios. Future work may involve applying these sparse-search techniques to other cryptographic primitives beyond AES to identify a broader range of software vulnerabilities.

Summary updated

BibTeX
@article{esfahani2020modified,
  author = {Mahdi Esfahani and Hadi Soleimany and Mohammad Reza Aref},
  title = {{Modified Cache Template Attack on AES}},
  journal = {IACR Cryptol. ePrint Arch.},
  year = {2020},
}
Figure