Mapping to Bits: Efficiently Detecting Type Confusion Errors
Title | Mapping to Bits: Efficiently Detecting Type Confusion Errors |
Publication Type | Conference Paper |
Year of Publication | 2018 |
Authors | Pang, Chengbin, Du, Yunlan, Mao, Bing, Guo, Shanqing |
Conference Name | Proceedings of the 34th Annual Computer Security Applications Conference |
Publisher | ACM |
Conference Location | New York, NY, USA |
ISBN Number | 978-1-4503-6569-7 |
Keywords | Collaboration, downcasting, Human Behavior, human factors, Metrics, policy-based governance, pubcrawl, resilience, Resiliency, Safe Coding, Safe Encoding Scheme, type confusion, typecasting |
Abstract | The features of modularity and inheritance in C++ facilitate the developers' usage, but also give rise to the problem of type confusion. As an ancestor class may have a different data layout from its descendant class, a dangerous downcasting operation from the ancestor to its descendant can lead to a critical attack, such as control flow hijacking, out-of-bounds access to neighbor memory area, etc. As reported in CVE, such vulnerabilities have been found in various common-used software, including Google Chrome, Firefox and Adobe Flash Player, and have a trend of increase in recent years. The urgency of addressing type confusion problems quickens the pace of researchers coming to corresponding solutions. However, the existing works either handle the problem partially, or suffer from the high performance and memory overhead, especially to the large-scale projects. We present Bitype to check the validity explicitly when a type is downcasting to another, maintaining high coverage and reducing overhead and compilation time massively. The core of our design is a Safe Encoding Scheme, which encodes all of the classes by mapping them to bits. With this scheme, Bitype treats the classes and their safe convertible classes as codes and verifies typecastings in an xor operation, both decreasing the performance overhead of check and the memory overhead. Besides, we implement a Clang Tool to avoid the repeated collection of inheritance relationships and deploy a two-level lookup table to trace objects efficiently. Evaluated on SPEC CPU2006 benchmarks and Firefox browser, Bitype shows a slightly higher coverage of typecasting compared to the state-of-the-art HexType[22], but reduces the performance overhead by 2 to 16 times, the memory overhead by 2 to 3 times, the compilation time by 21 to 223 times. As a result, our solution is a practical and efficient typecasting checker for commodity software. |
URL | https://dl.acm.org/citation.cfm?doid=3274694.3274719 |
DOI | 10.1145/3274694.3274719 |
Citation Key | pang_mapping_2018 |