Practical Control Flow Integrity and Randomization for Binary Executables

Chao Zhang, Tao Wei, Zhaofeng Chen, Lei Duan, Laszlo Szekeres, Stephen McCamant, Dawn Song, Wei ZouIEEE Symposium on Security and Privacy 2013 · OpenReview

Abstract

Control Flow Integrity (CFI) provides a strong protection against modern control-flow hijacking attacks. However, performance and compatibility issues limit its adoption. We propose a new practical and realistic protection method called CCFIR (Compact Control Flow Integrity and Randomization), which addresses the main barriers to CFI adoption. CCFIR collects all legal targets of indirect control-transfer instructions, puts them into a dedicated "Springboard section" in a random order, and then limits indirect transfers to flow only to them. Using the Springboard section for targets, CCFIR can validate a target more simply and faster than traditional CFI, and provide support for on-site target-randomization as well as better compatibility. Based on these approaches, CCFIR can stop control-flow hijacking attacks including ROP and return-into-libc. Results show that ROP gadgets are all eliminated. We observe that with the wide deployment of ASLR, Windows/x86 PE executables contain enough information in relocation tables which CCFIR can use to find all legal instructions and jump targets reliably, without source code or symbol information. We evaluate our prototype implementation on common web browsers and the SPEC CPU2000 suite: CCFIR protects large applications such as GCC and Firefox completely automatically, and has low performance overhead of about 3.6%/8.6% (average/max) using SPECint2000. Experiments on real-world exploits also show that CCFIR-hardened versions of IE6, Firefox 3.6 and other applications are protected effectively.

Introduction

Modern software security relies heavily on preventing control-flow hijacking. Despite defenses like Data Execution Prevention (DEP) and Address Space Layout Randomization (ASLR), attackers continue to exploit vulnerabilities using techniques such as Return-Oriented Programming (ROP) and return-to-libc. These methods stitch together existing code snippets (gadgets) to execute arbitrary logic.

Control Flow Integrity (CFI) is a powerful defense that restricts program execution to a predefined Control Flow Graph (CFG). However, traditional CFI implementations have faced significant adoption hurdles: high performance overhead (up to 45%), the requirement for source code or debug symbols, and poor compatibility with unhardened legacy libraries. This paper introduces CCFIR (Compact Control Flow Integrity and Randomization), a binary-only protection scheme designed to overcome these barriers.

Methodology: The Springboard Section

The core innovation of CCFIR is the Springboard section. Instead of checking every indirect jump against a complex graph at runtime, CCFIR identifies all legal indirect jump targets—such as function entries and return addresses—and replaces them with "stubs" in a dedicated, randomized memory region.

Transformation of control flow from original code to a protected version using the Springboard section.

Alignment-based Validation

CCFIR simplifies validation by using memory layout as a security policy. Different types of stubs (e.g., function pointers vs. return addresses) are aligned at specific intervals (8-byte or 16-byte). This allows for extremely fast validation using bit-masking. For example, the system can quickly verify if a target address resides within the Springboard and adheres to the required alignment for that specific jump type.

Memory layout of CCFIR, showing the Springboard sections and the use of the 27th bit for identification.

Binary-Only Analysis and Randomization

A key strength of CCFIR is its ability to process existing Windows x86 PE files without source code. It leverages relocation tables—metadata already present to support ASLR—to reliably identify code and data. Furthermore, CCFIR employs "on-site randomization" by permuting the order of stubs within the Springboard at load-time. This ensures that even if an attacker bypasses the CFI check, they cannot reliably predict the address of a target stub.

Evaluation

The authors evaluated CCFIR using the SPEC CPU2000 benchmark suite, real-world browsers (Firefox 3.6 and Internet Explorer 6), and 10 publicly available exploits from the Metasploit framework.

Performance and Security Results

  • Low Overhead: The average performance overhead on SPECint2000 was only 3.6%, with a maximum of 8.6%. This makes CCFIR one of the most efficient CFI implementations available.
  • Exploit Prevention: CCFIR successfully blocked all 10 real-world exploits tested, including those targeting Use-After-Free and stack overflow vulnerabilities.
  • Gadget Elimination: Analysis using tools like Mona confirmed that CCFIR effectively eliminated all usable ROP gadgets in protected binaries.
  • Scalability: The system demonstrated high scalability by automatically hardening large applications like Firefox’s xul.dll, which contains over 67,000 functions.

Discussion and Limitations

While CCFIR provides robust protection, some limitations remain. It currently does not support Just-In-Time (JIT) compiled code, which is common in modern web browsers. Additionally, information disclosure vulnerabilities could potentially allow an attacker to map the randomized Springboard. There is also a theoretical "Time-of-Check to Time-of-Use" (TOCTTOU) race condition in multi-threaded environments where a return address might be modified after validation but before execution.

Conclusion

CCFIR represents a significant step toward making CFI a practical reality for commercial software. By utilizing the Springboard section and leveraging existing binary metadata, it provides strong protection against control-flow hijacking with minimal performance impact and no requirement for source code.

Summary updated

Abstract

Control Flow Integrity (CFI) provides a strong protection against modern control-flow hijacking attacks. However, performance and compatibility issues limit its adoption. We propose a new practical and realistic protection method called CCFIR (Compact Control Flow Integrity and Randomization), which addresses the main barriers to CFI adoption. CCFIR collects all legal targets of indirect control-transfer instructions, puts them into a dedicated "Springboard section" in a random order, and then limits indirect transfers to flow only to them. Using the Springboard section for targets, CCFIR can validate a target more simply and faster than traditional CFI, and provide support for on-site target-randomization as well as better compatibility. Based on these approaches, CCFIR can stop control-flow hijacking attacks including ROP and return-into-libc. Results show that ROP gadgets are all eliminated. We observe that with the wide deployment of ASLR, Windows/x86 PE executables contain enough information in relocation tables which CCFIR can use to find all legal instructions and jump targets reliably, without source code or symbol information. We evaluate our prototype implementation on common web browsers and the SPEC CPU2000 suite: CCFIR protects large applications such as GCC and Firefox completely automatically, and has low performance overhead of about 3.6%/8.6% (average/max) using SPECint2000. Experiments on real-world exploits also show that CCFIR-hardened versions of IE6, Firefox 3.6 and other applications are protected effectively.
BibTeX
@inproceedings{zhang2013practical,
  author = {Chao Zhang and Tao Wei and Zhaofeng Chen and Lei Duan and Laszlo Szekeres and Stephen McCamant and Dawn Song and Wei Zou},
  title = {{Practical Control Flow Integrity and Randomization for Binary Executables}},
  booktitle = {IEEE Symposium on Security and Privacy},
  year = {2013},
  url = {https://openreview.net/forum?id=lm68dLmcBA},
}
Figure