Abstract
Return-Oriented Programming (ROP) is a typical attack technique that exploits return addresses to abuse existing code repeatedly. Most current return address protection mechanisms, such as Backward-Edge Control-Flow Integrity, work only under limited threat models—for instance, assuming an attacker cannot break memory isolation or lacks knowledge of secret keys. This paper presents Zipper Stack, a novel, lightweight mechanism that authenticates all return addresses using a chain structure of cryptographic message authentication codes (MACs). This design defends against powerful attackers with full memory control and knowledge of secret keys. Implemented via RISC-V ISA extensions, Zipper Stack demonstrates a low performance overhead of 1.86% on FPGA, making it highly suitable for real-world deployment.
Introduction: The Vulnerability of Return Addresses
The "return address" is a critical point of failure in software security. When a function completes, the CPU retrieves the return address from the stack to determine the next instruction. Attackers exploit this via Return-Oriented Programming (ROP), overwriting these addresses to hijack control flow.
While existing defenses like stack canaries and Address Space Layout Randomization (ASLR) provide some protection, they are often bypassed via memory leaks. Traditional Shadow Stacks, which maintain a hidden copy of return addresses, rely heavily on memory isolation. If an attacker discovers or modifies the shadow stack's memory space, the defense fails. Zipper Stack addresses these gaps by creating a defense that remains secure even under full memory compromise.
The Zipper Stack Mechanism
The core innovation of Zipper Stack is treating return addresses as links in a cryptographic chain. Unlike standard signing methods, Zipper Stack ensures that each link depends on the integrity of all previous links.
Integrity through Chaining
Each MAC is generated using two inputs: the current return address and the MAC of the previous return address. This creates a "tamper-evident" seal for the entire call history. The chain is anchored by a Top Register inside the CPU, which stores the most recent MAC. Because this register is physically inaccessible to standard instructions, it serves as an immutable root of trust.
Operational Logic: Call and Return
The "zipper" action occurs during function calls and returns:
- On
Call: The CPU pushes the current Top Register value and the return address onto the stack. It then calculates a new MAC based on these values and updates the Top Register. - On
Return: The CPU pops the address and the stored MAC, recalculates the link, and compares it to the Top Register. A mismatch triggers an immediate security exception.
Implementation and Evaluation
The authors implemented Zipper Stack through three primary avenues: a hardware extension for the RISC-V Rocket Core, a compiler-based approach using LLVM (utilizing x86 AES-NI instructions), and a Qemu-based simulation.
The system was evaluated using industry-standard benchmarks:
- SPEC CINT 2000/2006: To measure performance overhead across hardware and software implementations.
- Custom Attack Suite: 18 specific ROP and stack overflow attacks to verify security resilience.
- Real-world Compatibility: 50 random Ubuntu binaries were tested in the Qemu environment to assess general software compatibility.
Key Results
Zipper Stack achieves a rare balance of high security and low overhead:
- Performance: The FPGA-based RISC-V implementation showed a negligible performance hit of only 1.86%. On x86 using AES-NI, overhead ranged from 4.75% (light MAC) to 21.13% (full AES).
- Security: Zipper Stack defeated 100% of tested attacks, including those specifically designed to bypass traditional shadow stacks.
- Resilience: Even if an attacker leaks the secret key, they cannot forge a valid chain without finding a computational collision, which is infeasible.
Conclusion and Future Work
Zipper Stack provides a robust defense against ROP by eliminating the dependency on memory isolation. While it requires hardware modifications for optimal performance, its low overhead and high security make it a compelling candidate for future CPU architectures. Future work involves refining binary compatibility for complex stack unwinding scenarios (like setjmp/longjmp) and expanding support for non-LIFO control flows.
Summary updated