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

05/17/2020
by   Michael D. Brown, et al.
0

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.

READ FULL TEXT

page 8

page 9

page 20

page 28

research
07/04/2019

Security Implications Of Compiler Optimizations On Cryptography -- A Review

When implementing secure software, developers must ensure certain requir...
research
09/02/2020

CcNav: Understanding Compiler Optimizations in Binary Code

Program developers spend significant time on optimizing and tuning progr...
research
02/28/2019

Is Less Really More? Why Reducing Code Reuse Gadget Counts via Software Debloating Doesn't Necessarily Lead to Better Security

Nearly all modern software suffers from bloat that negatively impacts it...
research
11/17/2022

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

The availability of debug information for optimized executables can larg...
research
05/11/2018

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...
research
02/25/2019

Mitigating Power Side Channels during Compilation

The code generation modules inside modern compilers such as GCC and LLVM...
research
05/12/2020

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