Binary Recompilation via Dynamic Analysis and the Protection of Control and Data-flows Therein
Legacy binaries need to continue functioning even when no source code has been preserved, to support the workflows of government and industry. The binaries often lack recent improvements in compiler design and software engineering practices, causing them to be slower and less secure than modern binaries. Binary rewriting seeks to patch, optimize, instrument, or harden binaries to bridge this gap, but existing practice is limited by the underlying static analysis. We created a framework, BinRec, to use dynamic analysis to lift binaries to LLVM IR then recompile them, which overcomes the limitations of static analysis.The protection of software against memory corruption exploits has a rich history, which this thesis both systematizes and extends. We present a study of the performance, precision, and security of control-flow integrity (CFI). Data-only attacks can bypass CFI, and so we present a defense against these attacks. The application of these hardening techniques to binaries deserves further study, and we discuss the extent to which security hardening can be applied to recompiled binaries.This dissertation presents building blocks for the securing of legacy binaries using dynamic analysis, which we hope will become a dominant paradigm in the secure software ecosystem of tomorrow.