Not So Fast: Understanding and Mitigating Negative Impacts of Compiler Optimizations on Code Reuse Gadget Sets

by   Michael D. Brown, et al.

Despite extensive testing and correctness certification of their functional semantics, a number of compiler optimizations have been shown to violate security guarantees implemented in source code. While prior work has shed light on how such optimizations may introduce semantic security weaknesses into programs, there remains a significant knowledge gap concerning the impacts of compiler optimizations on non-semantic properties with security implications. In particular, little is currently known about how code generation and optimization decisions made by the compiler affect the availability and utility of reusable code segments (called gadgets) required to mount code reuse attack methods such as return-oriented programming. In this paper, we bridge this gap through a study of the impacts of compiler optimization on code reuse gadget populations. We analyze and compare 1,000 different variants of 17 different benchmark programs built with two production compilers (GCC and Clang) to determine how compiler optimization affects code reuse gadget sets available in program binaries. Our results expose an important and unexpected problem; compiler optimizations introduce new gadgets at a high rate and produce code containing gadgets that are generally more useful to an attacker crafting a code reuse exploit than those in unoptimized code. Using differential binary analysis, we identify several compiler behaviors at the root of this phenomenon. In turn, we show that these impacts can be significantly mitigated through security-focused post-production software transformation passes. Finally, we provide an analysis of the performance impacts of our proposed mitigations to demonstrate that they are negligible.


page 8

page 9

page 20

page 28


Security Implications Of Compiler Optimizations On Cryptography -- A Review

When implementing secure software, developers must ensure certain requir...

CcNav: Understanding Compiler Optimizations in Binary Code

Program developers spend significant time on optimizing and tuning progr...

Where Did My Variable Go? Poking Holes in Incomplete Debug Information

The availability of debug information for optimized executables can larg...

Enabling Cross-Event Optimization in Discrete-Event Simulation Through Compile-Time Event Batching

A discrete-event simulation (DES) involves the execution of a sequence o...

Mitigating Power Side Channels during Compilation

The code generation modules inside modern compilers such as GCC and LLVM...

CapablePtrs: Securely Compiling Partial Programs using the Pointers-as-Capabilities Principle

Capability machines such as CHERI provide memory capabilities that can b...

Please sign up or login with your details

Forgot password? Click here to reset