type++: Prohibiting Type Confusion with Inline Type Information

Type confusion, or bad casting, is a common C++ attack vector.Such vulnerabilities cause a program to interpret an object as belonging to a different type, enabling powerful attacks, like control-flow hijacking.C++ restricts runtime checks to polymorphic classes because only those have inline type information.The lack of runtime type information throughout an object's lifetime makes it challenging to enforce continuous checks and thereby prevent type confusion during downcasting.Current solutions either record type information for all objects disjointly, incurring prohibitive runtime overhead, or restrict protection to a fraction of all objects.Our C++ dialect, type++, enforces the paradigm that each allocated object involved in downcasting carries type information throughout its lifetime, ensuring correctness by enabling type checks wherever and whenever necessary.As not just polymorphic objects but all objects are typed, all down-to casts can now be dynamically verified.Compared to existing solutions, our strategy greatly reduces runtime cost and enables type++ usage both during testing and as mitigation.Targeting SPEC CPU2006 and CPU2017, we compile and run 2,040 kLoC, while changing only 314 LoC.To help developers, our static analysis warns where code changes in target programs may be necessary.Running the compiled benchmarks results in negligible performance overhead (1.19% on SPEC CPU2006 and 0.82% on SPEC CPU2017) verifying a total of 90B casts (compared to 3.8B for the state-ofthe-art, a 23 improvement).type++ discovers 122 type confusion issues in the SPEC CPU benchmarks among which 14 are new.Targeting Chromium, we change 229 LoC to protect 94.6% of the classes that could be involved in downcasting vulnerabilities, while incurring only 0.98% runtime overhead over the baseline.

Authors

Institutions

Publication Details

Published
2025-01-01
DOI
https://doi.org/10.14722/ndss.2025.230053
Citations
2
Primary Topic
Logic, Reasoning, and Knowledge
Type
article
Field-Weighted Citation Impact
4.96

Funders

Controls
|||
ALL TIME
JAN
FEB
MAR
APR
MAY
JUN
JUL
AUG
SEP
OCT
article

type++: Prohibiting Type Confusion with Inline Type Information

Flavio Toffalini, Yuseok Jeon, Mathias Payer, Nicolas Badoux
2 citations
Logic, Reasoning, and Knowledge
4.96
article

type++: Prohibiting Type Confusion with Inline Type Information

Flavio Toffalini, Yuseok Jeon, Mathias Payer, Nicolas Badoux
article en
2 citations

Abstract

Type confusion, or bad casting, is a common C++ attack vector.Such vulnerabilities cause a program to interpret an object as belonging to a different type, enabling powerful attacks, like control-flow hijacking.C++ restricts runtime checks to polymorphic classes because only those have inline type information.The lack of runtime type information throughout an object's lifetime makes it challenging to enforce continuous checks and thereby prevent type confusion during downcasting.Current solutions either record type information for all objects disjointly, incurring prohibitive runtime overhead, or restrict protection to a fraction of all objects.Our C++ dialect, type++, enforces the paradigm that each allocated object involved in downcasting carries type information throughout its lifetime, ensuring correctness by enabling type checks wherever and whenever necessary.As not just polymorphic objects but all objects are typed, all down-to casts can now be dynamically verified.Compared to existing solutions, our strategy greatly reduces runtime cost and enables type++ usage both during testing and as mitigation.Targeting SPEC CPU2006 and CPU2017, we compile and run 2,040 kLoC, while changing only 314 LoC.To help developers, our static analysis warns where code changes in target programs may be necessary.Running the compiled benchmarks results in negligible performance overhead (1.19% on SPEC CPU2006 and 0.82% on SPEC CPU2017) verifying a total of 90B casts (compared to 3.8B for the state-ofthe-art, a 23 improvement).type++ discovers 122 type confusion issues in the SPEC CPU benchmarks among which 14 are new.Targeting Chromium, we change 229 LoC to protect 94.6% of the classes that could be involved in downcasting vulnerabilities, while incurring only 0.98% runtime overhead over the baseline.

Electric Propulsion Laboratory (United States) (US)
Intel Corporation, European Commission, Schweizerischer Nationalfonds zur Förderung der Wissenschaftlichen Forschung, Fondation Botnar
Openalex Percentile: Top 6%
Logic, Reasoning, and Knowledge
4.96
AI Navigator

Ask Laika to Summarize, Analyze, and Connect papers live on the map.

Summarize Papers & Methodologies

Extract key findings, datasets, and comparative methods across publications.

Benchmark Rankings & Visual Analytics

Rank top research institutions, authors, funders, topics, and journals by Field-Weighted Citation Impact (FWCI) and paper volume with instant charts.

Connect Distant Disciplines

Bridge topological clusters on the map to find hidden collaborative intersections.