Devil is Virtual:Reversing Virtual Inheritance in C++ Binaries
Devil is Virtual: Reversing Virtual Inheritance in C++ Binaries
摘要:
在C++中实现面向对象的概念所产生的复杂性,如虚拟分派和动态类型转换,吸引了攻击者和防御者的注意。二进制级别的防御依赖于对给定程序的类继承树的完整和精确的恢复。虽然当前的解决方案集中于从二进制文件中恢复单个和多个继承,但它们忽略了虚拟继承。二进制级别防御中的传统观点是虚拟继承是不常见的,并且/或者对单个和多个继承的支持提供了对虚拟继承的隐式支持。在本文中,我们证明两者都不是真的。具体来说,(1)我们提出了一种有效的检测C++二进制文件中虚继承的方法,并通过研究表明,在包括Mysql和libstdc++在内的实际C++程序中,虚继承的存在率不容忽视(Linux上超过10%,Windows上超过12.5%)。(2)我们表明,未能处理虚拟继承在层次树中引入了误报和漏报。这些错误的肯定和否定或者在恢复的层次结构用于实施CFI策略时引入攻击面,或者在需要程序理解时使层次结构难以理解(例如,在反编译期间)。(3)我们提出了一个解决方案,以恢复虚拟继承COTS二进制文件。在虚拟继承树中,最大回收率为95%,中间基回收率为95.5%(GCC -O 0),最小回收率为77.5%,中间基回收率为73.8%(Clang -O2).
英文摘要:
Complexities that arise from implementation of object-oriented concepts in C++ such as virtual dispatch and dynamic type casting have attracted the attention of attackers and defenders alike. Binary-level defenses are dependent on full and precise recovery of class inheritance tree of a given program. While current solutions focus on recovering single and multiple inheritances from the binary, they are oblivious to virtual inheritance. Conventional wisdom among binary-level defenses is that virtual inheritance is uncommon and/or support for single and multiple inheritances provides implicit support for virtual inheritance. In this paper, we show neither to be true. Specifically, (1) we present an efficient technique to detect virtual inheritance in C++ binaries and show through a study that virtual inheritance can be found in non-negligible number (more than 10\% on Linux and 12.5\% on Windows) of real-world C++ programs including Mysql and libstdc++. (2) we show that failure to handle virtual inheritance introduces both false positives and false negatives in the hierarchy tree. These false positves and negatives either introduce attack surface when the hierarchy recovered is used to enforce CFI policies, or make the hierarchy difficult to understand when it is needed for program understanding (e.g., during decompilation). (3) We present a solution to recover virtual inheritance from COTS binaries. We recover a maximum of 95\% and 95.5\% (GCC -O0) and a minimum of 77.5\% and 73.8\% (Clang -O2) of virtual and intermediate bases respectively in the virtual inheritance tree.
机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。