NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Cryptographically Enforced Control Flow Integrity

Ali José Mashtizadeh, Andrea Bittau, David Mazières, Dan BoneharXiv 2014

Abstract

Control flow hijacking remains a critical threat to software security. This paper presents Cryptographically Enforced Control Flow Integrity (CCFI), a novel approach that uses hardware-accelerated Message Authentication Codes (MACs) to protect sensitive pointers. By storing cryptographic keys in dedicated CPU registers and leveraging AES-NI instructions, CCFI provides fine-grained protection against attackers with full memory access while maintaining performance overheads between 3% and 18% for typical web applications.

Introduction

Modern software security is a persistent challenge. Despite defenses like Address Space Layout Randomization (ASLR) and stack canaries, attackers continue to hijack program control flow by overwriting return addresses or function pointers. Traditional Control Flow Integrity (CFI) solutions often rely on static analysis, which can be overly permissive and vulnerable to memory disclosure bugs. CCFI addresses these limitations by shifting from static analysis to runtime cryptography, "signing" sensitive pointers before they are stored in memory.

Methods

The core of CCFI is the use of Message Authentication Codes (MACs) to ensure the integrity of control-flow elements such as return addresses, function pointers, and C++ vtable pointers.

MAC-based Protection and Contextual Integrity

Every time a control-flow element is stored in memory, CCFI computes a MAC. Upon loading, the system recomputes and verifies this MAC. To prevent "pointer swapping" or "replay attacks," the MAC calculation includes the memory address of the pointer and a type tag, ensuring that a valid return address cannot be misused as a function pointer.

Secure Key Storage and Hardware Acceleration

A critical challenge in any cryptographic system is key management. CCFI stores its secret keys in dedicated XMM registers on x86-64 architectures. The compiler is modified to ensure these registers are never spilled to memory, creating a "root of trust" inaccessible to attackers even with full memory read capabilities.

Comparison of register usage between the standard SysV ABI and the CCFI ABI, highlighting the reservation of XMM registers for cryptographic keys.

As shown in the table above, CCFI modifies the Application Binary Interface (ABI) to reserve specific XMM registers (xmm5-xmm15) for the "Expanded Key," whereas the standard SysV ABI uses them for arguments or temporary storage. The system leverages Intel’s AES-NI instructions to perform these cryptographic operations efficiently, typically requiring only about 40 CPU cycles per MAC.

Results

The authors evaluated CCFI using the SPEC2006 benchmark and real-world server software including nginx, Apache, and redis.

  • Performance: For standard web servers, CCFI introduced a modest overhead of 3–18% in request throughput. However, performance dropped by 38% for HTTPS traffic due to contention for AES-NI hardware and XMM registers.
  • Security and Compatibility: CCFI successfully prevented fine-grained pointer-swapping attacks. Remarkably, implementing this protection required modifying only three lines of code across 21 complex libraries, as most tasks were automated via a modified Clang/LLVM compiler.

Conclusion

CCFI demonstrates that hardware-accelerated cryptography can provide robust, fine-grained control flow integrity with manageable overhead. While challenges remain regarding replay attacks and resource contention in cryptographic-heavy workloads (like HTTPS), CCFI represents a significant step toward principled, runtime-enforced software security. Future work may explore slab allocators to further mitigate address reuse vulnerabilities.

Summary updated

BibTeX
@misc{mashtizadeh2014cryptographically,
  author = {Ali José Mashtizadeh and Andrea Bittau and David Mazières and Dan Boneh},
  title = {{Cryptographically Enforced Control Flow Integrity}},
  year = {2014},
  eprint = {1408.1451},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/1408.1451},
}
Figure