不那么快:理解和减轻对代码重用小工具集的优化的负面影响
Not So Fast: Understanding and Mitigating Negative Impacts of Compiler Optimizations on Code Reuse Gadget Sets
摘要:
尽管对它们的函数语义进行了广泛的测试和正确性认证,但许多编译器优化已被证明违反了源代码中实现的安全保证。虽然先前的工作已经阐明了这种优化如何可能会引入语义的安全弱点到程序中,仍然存在着显着的知识差距,编译器优化的影响与安全问题的非语义属性。特别是,目前很少有人知道如何由编译器的代码生成和优化决策影响的可用性和实用性的可重用代码段称为小工具所需的实现代码重用攻击方法,如返回导向编程。在本文中,我们通过研究编译器优化对代码重用小工具集的影响来弥合这一差距。我们分析和比较了1,187个变种的20个不同的基准程序与两个生产编译器(GCC和Clang),以确定他们的优化行为如何影响代码重用小工具集存在于程序变量的定量和定性指标。我们的研究暴露了一个重要的和意想不到的问题;编译器优化引入新的小工具,在高速率和生产的代码包含小工具集,通常是更有用的攻击者比那些在未优化的代码。使用差分二进制分析,我们确定了几个不良行为的根源,这种现象。反过来,我们提出并评估了几种策略,以减轻这些行为。特别是,我们表明,生产后的二进制重新编译可以有效地减轻这些行为,可以忽略不计的性能影响,导致优化的代码显着更小,更有用的小工具集。
英文摘要:
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 for implementing 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 sets. We analyze and compare 1,187 variants of 20 different benchmark programs built with two production compilers (GCC and Clang) to determine how their optimization behaviors affect the code reuse gadget sets present in program variants with respect to both quantitative and qualitative metrics. Our study exposes an important and unexpected problem; compiler optimizations introduce new gadgets at a high rate and produce code containing gadget sets that are generally more useful to an attacker than those in unoptimized code. Using differential binary analysis, we identify several undesirable behaviors at the root of this phenomenon. In turn, we propose and evaluate several strategies to mitigate these behaviors. In particular, we show that post-production binary recompilation can effectively mitigate these behaviors with negligible performance impacts, resulting in optimized code with significantly smaller and less useful gadget sets.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。