skip to main content
10.1145/2976749.2978405acmconferencesArticle/Chapter ViewAbstractPublication PagesccsConference Proceedingsconference-collections
research-article
Public Access

TypeSan: Practical Type Confusion Detection

Published: 24 October 2016 Publication History

Abstract

The low-level C++ programming language is ubiquitously used for its modularity and performance. Typecasting is a fundamental concept in C++ (and object-oriented programming in general) to convert a pointer from one object type into another. However, downcasting (converting a base class pointer to a derived class pointer) has critical security implications due to potentially different object memory layouts. Due to missing type safety in C++, a downcasted pointer can violate a programmer's intended pointer semantics, allowing an attacker to corrupt the underlying memory in a type-unsafe fashion. This vulnerability class is receiving increasing attention and is known as type confusion (or bad-casting). Several existing approaches detect different forms of type confusion, but these solutions are severely limited due to both high run-time performance overhead and low detection coverage.
This paper presents TypeSan, a practical type-confusion detector which provides both low run-time overhead and high detection coverage. Despite improving the coverage of state-of-the-art techniques, TypeSan significantly reduces the type-confusion detection overhead compared to other solutions. TypeSan relies on an efficient per-object metadata storage service based on a compact memory shadowing scheme. Our scheme treats all the memory objects (i.e., globals, stack, heap) uniformly to eliminate extra checks on the fast path and relies on a variable compression ratio to minimize run-time performance and memory overhead. Our experimental results confirm that TypeSan is practical, even when explicitly checking almost all the relevant typecasts in a given C++ program. Compared to the state of the art, TypeSan yields orders of magnitude higher coverage at 4--10 times lower performance overhead on SPEC and 2 times on Firefox. As a result, our solution offers superior protection and is suitable for deployment in production software. Moreover, our highly efficient metadata storage back-end is potentially useful for other defenses that require memory object tracking.

References

[1]
M. Abadi, M. Budiu, U. Erlingsson, and J. Ligatti. Control-flow integrity. In CCS, 2005.
[2]
P. Akritidis, M. Costa, M. Castro, and S. Hand. Baggy bounds checking: An efficient and backwards-compatible defense against out-of-bounds errors. In USENIX Security, 2009.
[3]
D. Bounov, R. G. Kıcı, and S. Lerner. Protecting c+ dynamic dispatch through vtable interleaving. In NDSS, 2016.
[4]
Clang. Clang 3.9 documentation - control flow integrity. http://clang.llvm.org/docs/ControlFlowIntegrity.html.
[5]
D. Dewey and J. Giffin. Static detection of c+ vtable escape vulnerabilities in binary code. In NDSS, 2012.
[6]
T. M. Foundation. Dromaeo, javascript performance testing. https://www.webkit.org/perf/sunspider/sunspider.html.
[7]
S. Ghemawat and P. Menage. Tcmalloc: Thread-caching malloc. http://goog-perftools.sourceforge.net/doc/tcmalloc.html, 2009.
[8]
E. Goktas, R. Gawlik, B. Kollenda, E. Athanasopoulos, G. Portokalidis, C. Giuffrida, and H. Bos. Undermining information hiding (and what to do about it). In USENIX Security, 2016.
[9]
Google. Octane benchmark. https://code.google.com/p/octane-benchmark.
[10]
Google. Sunspider benchmark. https://www.webkit.org/perf/sunspider/sunspider.html.
[11]
I. Haller, E. Goktas, E. Athanasopoulos, G. Portokalidis, and H. Bos. Shrinkwrap: Vtable protection without loose ends. In ACSAC, 2015.
[12]
J. L. Henning. Spec cpu2006 benchmark descriptions. ACM SIGARCH Computer Architecture News, 34(4):1--17, 2006.
[13]
V. Kuznetsov, L. Szekeres, M. Payer, G. Candea, R. Sekar, and D. Song. Code-pointer integrity. In OSDI, 2014.
[14]
C. Lattner and V. Adve. Llvm: A compilation framework for lifelong program analysis & transformation. In CGO, pages 75--86. IEEE, 2004.
[15]
B. Lee, C. Song, T. Kim, and W. Lee. Caver source code. https://github.com/sslab-gatech/caver.
[16]
B. Lee, C. Song, T. Kim, and W. Lee. Type casting verification: Stopping an emerging attack vector. In USENIX Security, 2015.
[17]
T. Mytkowicz, A. Diwan, M. Hauswirth, and P. F. Sweeney. Producing wrong data without doing anything obviously wrong! ACM Sigplan Notices, 44(3):265--276, 2009.
[18]
A. Oikonomopoulos, E. Athanasopoulos, H. Bos, and C. Giuffrida. Poking holes in information hiding. In USENIX Security, 2016.
[19]
G. C. Project. Undefined behavior sanitizer. https://www.chromium.org/developers/testing/undefinedbehaviorsanitizer.
[20]
C. Tice, T. Roeder, P. Collingbourne, S. Checkoway, U. Erlingsson, L. Lozano, and G. Pike. Enforcing forward-edge control-flow integrity in gcc & llvm. In USENIX Security, 2014.
[21]
V. van der Veen, D. Andriesse, E. Göktas, B. Gras, L. Sambuc, A. Slowinska, H. Bos, and C. Giuffrida. Practical Context-Sensitive CFI. In CCS, 2015.
[22]
V. van der Veen, E. Goktas, M. Contag, A. Pawlowski, X. Chen, S. Rawat, H. Bos, T. Holz, E. Athanasopoulos, and C. Giuffrida. A tough call: Mitigating advanced code-reuse attacks at the binary level. In IEEE S&P, 2016.
[23]
J. Wagner, V. Kuznetsov, G. Candea, and J. Kinder. High system-code security with low overhead. In IEEE S&P, 2015.
[24]
C. Zhang, S. A. Carr, T. Li, Y. Ding, C. Song, M. Payer, and D. Song. Vtrust: Regaining trust on virtual calls. In NDSS, 2016.

Cited By

View all
  • (2024)Don't waste my effortsProceedings of the 33rd USENIX Conference on Security Symposium10.5555/3698900.3698980(1419-1434)Online publication date: 14-Aug-2024
  • (2024)Not quite writeProceedings of the 18th USENIX Conference on Offensive Technologies10.5555/3696933.3696946(171-187)Online publication date: 12-Aug-2024
  • (2024)Typed and Confused: Studying the Unexpected Dangers of Gradual TypingProceedings of the 39th IEEE/ACM International Conference on Automated Software Engineering10.1145/3691620.3695549(1858-1870)Online publication date: 27-Oct-2024
  • Show More Cited By

Index Terms

  1. TypeSan: Practical Type Confusion Detection

    Recommendations

    Comments

    Information & Contributors

    Information

    Published In

    cover image ACM Conferences
    CCS '16: Proceedings of the 2016 ACM SIGSAC Conference on Computer and Communications Security
    October 2016
    1924 pages
    ISBN:9781450341394
    DOI:10.1145/2976749
    Permission to make digital or hard copies of all or part of this work for personal or classroom use is granted without fee provided that copies are not made or distributed for profit or commercial advantage and that copies bear this notice and the full citation on the first page. Copyrights for components of this work owned by others than the author(s) must be honored. Abstracting with credit is permitted. To copy otherwise, or republish, to post on servers or to redistribute to lists, requires prior specific permission and/or a fee. Request permissions from [email protected].

    Sponsors

    Publisher

    Association for Computing Machinery

    New York, NY, United States

    Publication History

    Published: 24 October 2016

    Permissions

    Request permissions for this article.

    Check for updates

    Author Tags

    1. downcasting
    2. type confusion
    3. type safety
    4. typecasting

    Qualifiers

    • Research-article

    Funding Sources

    Conference

    CCS'16
    Sponsor:

    Acceptance Rates

    CCS '16 Paper Acceptance Rate 137 of 831 submissions, 16%;
    Overall Acceptance Rate 1,261 of 6,999 submissions, 18%

    Upcoming Conference

    CCS '25

    Contributors

    Other Metrics

    Bibliometrics & Citations

    Bibliometrics

    Article Metrics

    • Downloads (Last 12 months)220
    • Downloads (Last 6 weeks)36
    Reflects downloads up to 02 Mar 2025

    Other Metrics

    Citations

    Cited By

    View all
    • (2024)Don't waste my effortsProceedings of the 33rd USENIX Conference on Security Symposium10.5555/3698900.3698980(1419-1434)Online publication date: 14-Aug-2024
    • (2024)Not quite writeProceedings of the 18th USENIX Conference on Offensive Technologies10.5555/3696933.3696946(171-187)Online publication date: 12-Aug-2024
    • (2024)Typed and Confused: Studying the Unexpected Dangers of Gradual TypingProceedings of the 39th IEEE/ACM International Conference on Automated Software Engineering10.1145/3691620.3695549(1858-1870)Online publication date: 27-Oct-2024
    • (2024)Top of the Heap: Efficient Memory Error Protection of Safe Heap ObjectsProceedings of the 2024 on ACM SIGSAC Conference on Computer and Communications Security10.1145/3658644.3690310(1330-1344)Online publication date: 2-Dec-2024
    • (2024)A Survey of Software Dynamic Analysis MethodsProgramming and Computing Software10.1134/S036176882401007950:1(90-114)Online publication date: 1-Feb-2024
    • (2024)Enhancing a Lock-and-Key Scheme With MTE to Mitigate Use-After-FreesIEEE Access10.1109/ACCESS.2023.334377712(5462-5476)Online publication date: 2024
    • (2023)UNCONTAINEDProceedings of the 32nd USENIX Conference on Security Symposium10.5555/3620237.3620520(5055-5072)Online publication date: 9-Aug-2023
    • (2023)Detecting union type confusion in component object modelProceedings of the 32nd USENIX Conference on Security Symposium10.5555/3620237.3620476(4265-4281)Online publication date: 9-Aug-2023
    • (2023)Accelerating Type Confusion Detection by Identifying Harmless Type CastingsProceedings of the 20th ACM International Conference on Computing Frontiers10.1145/3587135.3592205(91-100)Online publication date: 9-May-2023
    • (2023)Dissecting American Fuzzy Lop: A FuzzBench EvaluationACM Transactions on Software Engineering and Methodology10.1145/358059632:2(1-26)Online publication date: 20-Jan-2023
    • Show More Cited By

    View Options

    View options

    PDF

    View or Download as a PDF file.

    PDF

    eReader

    View online with eReader.

    eReader

    Login options

    Figures

    Tables

    Media

    Share

    Share

    Share this Publication link

    Share on social media