MemPoline: Mitigating Memory-based Side-Channel Attacks through Memory Access Obfuscation

Zhen Hang Jiang, Yunsi Fei, Aidong Adam Ding, Thomas WahlIACR ePrint 2020

Abstract

MemPoline is a novel software-based countermeasure designed to thwart memory-based side-channel attacks by constantly and randomly shuffling sensitive data within memory. By utilizing efficient "parameter-directed permutations" instead of heavy-duty Oblivious RAM (ORAM), it achieves $O(1)$ access time and provides "just-in-need" security with significantly lower performance overhead than prior state-of-the-art solutions.

Introduction: The Threat of Memory Side-Channels

Cryptographic algorithms like AES and RSA are mathematically secure, but their physical implementations often leak secrets through "side channels." Memory-based side-channel attacks, such as Flush+Reload and Prime+Probe, exploit the fact that a program's memory access patterns often depend on secret keys. By observing microarchitectural events—like cache hits, misses, or bank conflicts—an attacker co-resident on the same hardware can reconstruct these patterns and steal the key.

Figure 1: Overview of memory-based side-channel attacks and corresponding countermeasures across the memory hierarchy.

Existing defenses generally fall into two camps: expensive, non-portable hardware modifications or software-based ORAM. While ORAM is highly secure, it is notoriously slow, often imposing a 100x or greater performance penalty. MemPoline bridges this gap by providing robust protection with a much smaller performance footprint.

The MemPoline Approach: Parameter-Directed Permutation

MemPoline obfuscates memory access patterns through a technique called parameter-directed permutation. This approach focuses on "just-in-need" security, shuffling data faster than an attacker can statistically distinguish a pattern.

Figure 2: The internal mechanics of MemPoline, illustrating data initialization, diagonal grouping, and the permutation process during memory access.

Core Mechanisms

  • Limb-based Shuffling: Sensitive data structures (e.g., AES T-tables) are broken into "limbs," typically 4 bytes to match cache bank sizes.
  • Diagonal Grouping: To prevent leakage from specific cache lines or banks, limbs are organized into diagonal groups. This ensures that moving a limb changes both its cache line (row) and bank (column) simultaneously, addressing side channels at multiple granularities.
  • XOR Permutations: Instead of complex lookup tables, MemPoline uses a simple XOR-based function ($j = i \oplus r$) where $i$ is the original index and $r$ is a secret random parameter, ensuring $O(1)$ complexity.
  • Epochs of Permuting: Shuffling is progressive. Every access moves a data element from an old permuted state ($r_1$) to a new one ($r_2$). Once a group has migrated, $r_2$ becomes the new baseline.

Developers can integrate these protections via a simple API consisting of four functions: mp_init, mp_save, mp_locate_and_swap, and mp_free.

Experimental Evaluation

The authors evaluated MemPoline using standard cryptographic libraries, including OpenSSL 1.0.2n (AES-128 T-tables) and GnuPG-1.4.18 (RSA sliding-window). Tests were conducted on Intel i7 Sandy Bridge CPUs and Nvidia Kepler K40 GPUs to demonstrate cross-platform portability.

Security and Performance Results

  • Security Robustness: Using the Kolmogorov-Smirnov (KS) null-test, the authors demonstrated that timing distributions for access events become statistically indistinguishable with MemPoline. Attackers could not recover the AES key even with $2^{32}$ samples.
  • Performance Overhead:
    • AES: MemPoline caused a 12x slowdown. While high, this is a significant improvement over ORAM-based defenses that often exceed 100x.
  • RSA: The overhead was a negligible 4%, as RSA is more computationally intensive with fewer sensitive memory accesses.
  • Comparative Benchmarking: In a Histogram benchmark, the ORAM-based "Raccoon" system showed a 144x slowdown, whereas MemPoline showed only a 1.4% slowdown.

Discussion and Future Work

MemPoline's microarchitecture-aware design allows it to be algorithm-agnostic, protecting any sensitive table regardless of the underlying cryptographic process. However, it currently requires manual instrumentation by developers. Future work includes developing compiler-level automation to identify secret-dependent accesses and expanding the system to protect instruction fetch patterns (control flow) in addition to data memory.

Summary updated

BibTeX
@article{jiang2020mempoline,
  author = {Zhen Hang Jiang and Yunsi Fei and Aidong Adam Ding and Thomas Wahl},
  title = {{MemPoline: Mitigating Memory-based Side-Channel Attacks through Memory Access Obfuscation}},
  journal = {IACR Cryptol. ePrint Arch.},
  year = {2020},
}
Figure