Practical Opcode-based Fault Attack on AES-NI

Xue Gong, Xin Zhang, Qianmei Wu, Fan Zhang, Junge Xu, Qingni Shen, Zhi ZhangIACR Trans. Cryptogr. Hardw. Embed. Syst 2025

Abstract

Intel’s Advanced Encryption Standard New Instructions (AES-NI) were designed to provide high-performance, side-channel resistant cryptographic operations. This paper reveals a significant implementation-level vulnerability where software-induced hardware faults—specifically single-bit flips in instruction opcodes—can be exploited to extract secret keys. By leveraging the Rowhammer exploit to target specific opcodes, the researchers demonstrate that AES-128, 192, and 256 keys can be recovered in approximately 60 to 80 minutes.

Introduction

AES-NI instructions move cryptographic operations into hardware to mitigate traditional software-based side-channel attacks like timing or cache leaks. While effective against passive observation, their resilience against active fault injection has been a critical security concern. Historically, fault attacks required physical access to manipulate voltage or clock cycles. This research introduces Opcode-based Fault Analysis (OFA), a remote, software-only attack that exploits the binary encoding of the instruction set architecture (ISA).

Opcode Proximity and Vulnerability

The core discovery is that several critical AES-NI instructions have opcodes that differ by only a single bit. This low Hamming distance makes the system inherently vulnerable to bit-flip attacks. For instance, the instruction for a normal encryption round (AESENC) and the last encryption round (AESENCLAST) are nearly identical in their binary representation.

Table of AES-NI instruction pairs showing single-bit differences in their opcodes.

By using the Rowhammer exploit—which flips bits in DRAM through rapid memory access—an attacker can target the memory pages where the program code resides. A single bit flip can transform a AESENCLAST instruction into an AESENC instruction, fundamentally altering the processor's logic during execution.

Opcode-based Fault Analysis (OFA)

The attack targets the final round of the AES process. In a standard AES execution, the last round skips the MixColumns transformation. However, if a fault turns the AESENCLAST instruction into a AESENC instruction, the processor executes a "Normal Round" instead, which includes the MixColumns step.

Diagram illustrating the OFA attack flow, comparing a correct execution path with a faulted path where an extra MixColumns step is introduced.

By comparing the correct ciphertext ($C$) with the faulty ciphertext ($C'$), the attacker can establish a system of linear equations over the finite field $F_{2^8}$. Solving these equations via Gaussian elimination reduces the search space for the last round key to $2^{32}$, a range that can be brute-forced in minutes on a standard PC. For longer keys (AES-192 and AES-256), an Enhanced OFA (EOFA) method targets the penultimate round to further narrow the master key.

Experimental Results

The researchers evaluated the attack on various Intel systems (Core i3-10100 and legacy Lenovo T420) running Ubuntu 22.04. The attack proved highly efficient, requiring only a single pair of correct and faulty ciphertexts to succeed once the bit-flip is achieved.

  • AES-128 (ECB/CBC): Keys recovered in approximately 1.03 to 1.17 hours.
  • AES-192 (ECB): Keys recovered in 1.36 hours.
  • Search Space Reduction: The attack successfully reduced the complexity from $2^{128}$ to $2^{32}$ for AES-128 and to $2^{64}$ for AES-256.

Conclusion and Mitigations

This research highlights that the digital proximity of instructions in an ISA is a significant security risk. To defend against OFA, hardware designers should ensure a minimum Hamming distance of at least 2 or 3 bits between related cryptographic opcodes. Software-level defenses, such as memory isolation techniques (e.g., RIP-RH), can also help mitigate the risk of Rowhammer-based opcode manipulation.

Summary updated

BibTeX
@article{gong2025practical,
  author = {Xue Gong and Xin Zhang and Qianmei Wu and Fan Zhang and Junge Xu and Qingni Shen and Zhi Zhang},
  title = {{Practical Opcode-based Fault Attack on AES-NI}},
  journal = {IACR Trans. Cryptogr. Hardw. Embed. Syst.},
  year = {2025},
  doi = {10.46586/tches.v2025.i3.693-716},
}
Figure