Devil is Virtual: Reversing Virtual Inheritance in C++ Binaries

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%) 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 up to 100% of virtual bases and 95.5% of intermediate bases in the virtual inheritance tree.

READ FULL TEXT
research
07/07/2020

VPS: Excavating High-Level C++ Constructs from Low-Level Binaries to Protect Dynamic Dispatching

Polymorphism and inheritance make C++ suitable for writing complex softw...
research
01/29/2019

DeClassifier: Class-Inheritance Inference Engine for Optimized C++ Binaries

Recovering class inheritance from C++ binaries has several security bene...
research
12/20/2018

Automated CFI Policy Assessment with Reckon

Protecting programs against control-flow hijacking attacks recently has ...
research
02/22/2020

Modeling the Invariance of Virtual Pointers in LLVM

Devirtualization is a compiler optimization that replaces indirect (virt...
research
11/21/2002

Thinking Adaptive: Towards a Behaviours Virtual Laboratory

In this paper we name some of the advantages of virtual laboratories; an...
research
04/09/2019

Deep Virtual Networks for Memory Efficient Inference of Multiple Tasks

Deep networks consume a large amount of memory by their nature. A natura...
research
01/28/2018

Virtual Breakpoints for x86/64

Efficient, reliable trapping of execution in a program at the desired lo...

Please sign up or login with your details

Forgot password? Click here to reset