Dead store elimination is a widely used compiler optimization that reduces code size and improves performance. However, it can also remove seemingly useless memory writes that the programmer intended to clear sensitive data after its last use. Security-savvy developers have long been aware of this phenomenon and have devised ways to prevent the compiler from eliminating these data scrubbing operations. In this paper, we survey the set of techniques found in the wild that are intended to prevent data-scrubbing operations from being removed during dead store elimination. We evaluated the effectiveness and availability of each technique and found that some fail to protect data-scrubbing writes. We also examined eleven open source security projects to determine whether their specific memory scrubbing function was effective and whether it was used consistently. We found four of the eleven projects using flawed scrubbing techniques that may fail to scrub sensitive data and an additional four projects not using their scrubbing function consistently. We address the problem of dead store elimination removing scrubbing operations with a compiler-based approach by adding a new option to an LLVM-based compiler that retains scrubbing operations. We also synthesized existing techniques to develop a best-of-breed scrubbing function and are making it available to developers.
[1]
Xavier Leroy,et al.
Formal certification of a compiler back-end or: programming a compiler with a proof assistant
,
2006,
POPL '06.
[2]
Kedar S. Namjoshi,et al.
Securing a Compiler Transformation
,
2016,
SAS.
[3]
Nick Benton,et al.
Simple relational correctness proofs for static analyses and program transformations
,
2004,
POPL.
[4]
Dawn Xiaodong Song,et al.
The Correctness-Security Gap in Compiler Optimization
,
2015,
2015 IEEE Security and Privacy Workshops.
[5]
Wenke Lee,et al.
UniSan: Proactive Kernel Memory Initialization to Eliminate Data Leakages
,
2016,
CCS.
[6]
Armando Solar-Lezama,et al.
Towards optimization-safe systems: analyzing the impact of undefined behavior
,
2013,
SOSP.
[7]
Robert C. Seacord.
The CERT C Secure Coding Standard
,
2008
.