Skip to content
Vol. 1 · Ed. 2026
CyberGlossary
Entry № 1182

Type Confusion Vulnerability

What is Type Confusion Vulnerability?

Type Confusion VulnerabilityA memory-safety bug where code accesses an object using a type incompatible with its real allocation, often enabling arbitrary read, write, or code execution.


A type confusion vulnerability arises when a program reads or writes memory through a pointer or reference whose declared type differs from the underlying object's actual type. The typical trigger is missing or incorrect downcasting, polymorphism mishandling, or speculative JIT optimizations that assume a stable shape that the attacker can change. Once the runtime treats a structure as the wrong type, methods, vtables, length fields, and inline data are misinterpreted, giving the attacker controlled read/write primitives that often escalate to code execution. JavaScript engines (V8 in Chrome, JSC in Safari) and browser renderers are frequent targets, frequently demonstrated at Pwn2Own. Defenses include strong type systems, runtime checks, sandboxing, and bounds-safe languages.

Examples

  1. 01

    CVE-2021-30551 V8 type-confusion exploited as a 0-day in Chrome.

  2. 02

    A C++ static_cast where dynamic_cast was required, allowing a child-class write into an unrelated object.

Frequently asked questions

What is Type Confusion Vulnerability?

A memory-safety bug where code accesses an object using a type incompatible with its real allocation, often enabling arbitrary read, write, or code execution. It belongs to the Application Security category of cybersecurity.

What does Type Confusion Vulnerability mean?

A memory-safety bug where code accesses an object using a type incompatible with its real allocation, often enabling arbitrary read, write, or code execution.

How does Type Confusion Vulnerability work?

A type confusion vulnerability arises when a program reads or writes memory through a pointer or reference whose declared type differs from the underlying object's actual type. The typical trigger is missing or incorrect downcasting, polymorphism mishandling, or speculative JIT optimizations that assume a stable shape that the attacker can change. Once the runtime treats a structure as the wrong type, methods, vtables, length fields, and inline data are misinterpreted, giving the attacker controlled read/write primitives that often escalate to code execution. JavaScript engines (V8 in Chrome, JSC in Safari) and browser renderers are frequent targets, frequently demonstrated at Pwn2Own. Defenses include strong type systems, runtime checks, sandboxing, and bounds-safe languages.

How do you defend against Type Confusion Vulnerability?

Defences for Type Confusion Vulnerability typically combine technical controls and operational practices, as detailed in the full definition above.

What are other names for Type Confusion Vulnerability?

Common alternative names include: Bad cast, Type-mismatch bug.

Related terms