Skip to content
Memory corruption Advisory Advanced CVE-2024-7550

Type Confusion in V8 (CVE-2024-7550)

A type confusion in V8's Maglev compiler allowed a crafted JavaScript program to trigger a debug check failure, causing a crash. The report does not demonstrate code execution or other impact beyond the crash.

Zhenghang Xiao Follow

Originally disclosed on Chrome VRP

Bounty$7,000 High View original
  • Fix shipped in 13 days

VULNERABILITY DETAILS

INTRODUCE

Without a doubt, the true introduction of this vulnerability, like most previous confusions between wasm and js objects, can be traced back to the point where wasm arrays and wasm structs were introduced.

CRASH LOG

  • Debug output
Bash
#
# Fatal error in ../../src/compiler/heap-refs.cc, line 1127
# Debug check failed: IsJSObject().
#
#
#
#FailureMessage Object: 0x7f6ebeffb250
==== C stack trace ===============================

    d8-linux-debug-v8-component-95248/libv8_libbase.so(v8::base::debug::StackTrace::StackTrace()+0x13) [0x7f6ef59f4aa3]
    d8-linux-debug-v8-component-95248/libv8_libplatform.so(+0x19add) [0x7f6efb1ddadd]
    d8-linux-debug-v8-component-95248/libv8_libbase.so(V8_Fatal(char const*, int, char const*, ...)+0x194) [0x7f6ef59d6234]
    d8-linux-debug-v8-component-95248/libv8_libbase.so(+0x2bc55) [0x7f6ef59d5c55]
    d8-linux-debug-v8-component-95248/libv8.so(v8::internal::compiler::ObjectRef::AsJSObject() const+0x65) [0x7f6efa1bf575]
    d8-linux-debug-v8-component-95248/libv8.so(v8::internal::maglev::MaglevGraphBuilder::InferHasInPrototypeChain(v8::internal::maglev::ValueNode*, v8::internal::compiler::HeapObjectRef)+0x13a) [0x7f6ef963038a]
    d8-linux-debug-v8-component-95248/libv8.so(v8::internal::maglev::MaglevGraphBuilder::BuildHasInPrototypeChain(v8::internal::maglev::ValueNode*, v8::internal::compiler::HeapObjectRef)+0x1c) [0x7f6ef963071c]
    d8-linux-debug-v8-component-95248/libv8.so(v8::internal::maglev::MaglevGraphBuilder::TryBuildFastOrdinaryHasInstance(v8::internal::maglev::ValueNode*, v8::internal::compiler::JSObjectRef, v8::internal::maglev::ValueNode*)+0x278) [0x7f6ef9630aa8]
    d8-linux-debug-v8-component-95248/libv8.so(v8::internal::maglev::MaglevGraphBuilder::BuildOrdinaryHasInstance(v8::internal::maglev::ValueNode*, v8::internal::compiler::JSObjectRef, v8::internal::maglev::ValueNode*)+0x22) [0x7f6ef961d892]
    d8-linux-debug-v8-component-95248/libv8.so(v8::internal::maglev::MaglevGraphBuilder::TryBuildFastInstanceOf(v8::internal::maglev::ValueNode*, v8::internal::compiler::JSObjectRef, v8::internal::maglev::ValueNode*)+0x438) [0x7f6ef9630f48]
    d8-linux-debug-v8-component-95248/libv8.so(v8::internal::maglev::MaglevGraphBuilder::TryBuildFastInstanceOfWithFeedback(v8::internal::maglev::ValueNode*, v8::internal::maglev::ValueNode*, v8::internal::compiler::FeedbackSource)+0x163) [0x7f6ef9631943]
    d8-linux-debug-v8-component-95248/libv8.so(v8::internal::maglev::MaglevGraphBuilder::VisitTestInstanceOf()+0xa0) [0x7f6ef9631a00]
    d8-linux-debug-v8-component-95248/libv8.so(v8::internal::maglev::MaglevGraphBuilder::VisitSingleBytecode()+0xd7a) [0x7f6ef951dcaa]
    d8-linux-debug-v8-component-95248/libv8.so(v8::internal::maglev::MaglevGraphBuilder::BuildBody()+0x12a) [0x7f6ef951907a]
    d8-linux-debug-v8-component-95248/libv8.so(v8::internal::maglev::MaglevGraphBuilder::Build()+0x3bb) [0x7f6ef9515eab]
    d8-linux-debug-v8-component-95248/libv8.so(v8::internal::maglev::MaglevCompiler::Compile(v8::internal::LocalIsolate*, v8::internal::maglev::MaglevCompilationInfo*)+0x6d0) [0x7f6ef9514910]
    d8-linux-debug-v8-component-95248/libv8.so(v8::internal::maglev::MaglevCompilationJob::ExecuteJobImpl(v8::internal::RuntimeCallStats*, v8::internal::LocalIsolate*)+0x66) [0x7f6ef95de6c6]
    d8-linux-debug-v8-component-95248/libv8.so(v8::internal::OptimizedCompilationJob::ExecuteJob(v8::internal::RuntimeCallStats*, v8::internal::LocalIsolate*)+0x8d) [0x7f6ef83b5f1d]
    d8-linux-debug-v8-component-95248/libv8.so(v8::internal::maglev::MaglevConcurrentDispatcher::JobTask::Run(v8::JobDelegate*)+0x39b) [0x7f6ef95e041b]
    d8-linux-debug-v8-component-95248/libv8_libplatform.so(v8::platform::DefaultJobWorker::Run()+0xd3) [0x7f6efb1dc883]
    d8-linux-debug-v8-component-95248/libv8_libplatform.so(v8::platform::DefaultWorkerThreadsTaskRunner::WorkerThread::Run()+0xcc) [0x7f6efb1decbc]
    d8-linux-debug-v8-component-95248/libv8_libbase.so(+0x497f8) [0x7f6ef59f37f8]
    /lib/x86_64-linux-gnu/libc.so.6(+0x94ac3) [0x7f6ef5294ac3]
    /lib/x86_64-linux-gnu/libc.so.6(+0x126850) [0x7f6ef5326850]
[6]    1307572 trace trap  d8-linux-debug-v8-component-95248/d8 poc.js

VERSION Tested on v8 version: 11.9.0 - 12.0.0

REPRODUCTION CASE

  1. Download debug v8 from: gs://v8-asan/linux-debug/d8-linux-debug-v8-component-95248.zip
  2. Run: d8 poc.js

FOR CRASHES, PLEASE INCLUDE THE FOLLOWING ADDITIONAL INFORMATION Type of crash: tab

CREDIT INFORMATION Reporter credit: Zhenghang Xiao (@Kipreyyy)

The original report as published on the Chromium issue tracker, by Zhenghang Xiao (@Kipreyyy). Images and videos are our own copies; raw HTML is shown as text. View it on Chromium issue tracker.

The original is short, so this covers everything it reports, then explains this kind of bug in general: how it works, how to test for it and how it is fixed. The general sections are about the bug class, not this target. Written with AI and checked against the original; the original is the record. 7 min read.

What the report shows

This is a Chrome VRP advisory for a type confusion in V8, tracked as CVE-2024-7550, reported by Zhenghang Xiao (@Kipreyyy). The platform records it as high severity, affecting the V8 JavaScript engine, with a bounty of 7,000 USD and disclosure on 6 August 2024. The report itself is short: it gives a crash log, a version range and a two-step reproduction, but no root-cause analysis and no exploit.

The researcher frames the bug as another instance of confusion between WebAssembly and JavaScript objects, and traces the class back to the introduction of wasm arrays and wasm structs. That is the whole of the introduction; the report does not explain which specific operation mixes the two object kinds.

The crash shown is a debug assertion in the Maglev compiler. The fatal check is IsJSObject() in heap-refs.cc, line 1127, reached from ObjectRef::AsJSObject(). The stack shows the path clearly: the Maglev graph builder visits a TestInstanceOf bytecode, tries to build a fast instanceof (TryBuildFastInstanceOf, BuildOrdinaryHasInstance, TryBuildFastOrdinaryHasInstance), and then calls BuildHasInPrototypeChain and InferHasInPrototypeChain. At that point it holds a heap object reference that it assumes is a JSObject and asserts that it is one. The assertion fails, so the object reaching the prototype-chain check is not a JSObject.

Bash
#
# Fatal error in ../../src/compiler/heap-refs.cc, line 1127
# Debug check failed: IsJSObject().
#
#
#
#FailureMessage Object: 0x7f6ebeffb250
==== C stack trace ===============================

    d8-linux-debug-v8-component-95248/libv8_libbase.so(v8::base::debug::StackTrace::StackTrace()+0x13) [0x7f6ef59f4aa3]
    d8-linux-debug-v8-component-95248/libv8_libplatform.so(+0x19add) [0x7f6efb1ddadd]
    d8-linux-debug-v8-component-95248/libv8_libbase.so(V8_Fatal(char const*, int, char const*, ...)+0x194) [0x7f6ef59d6234]
    d8-linux-debug-v8-component-95248/libv8_libbase.so(+0x2bc55) [0x7f6ef59d5c55]
    d8-linux-debug-v8-component-95248/libv8.so(v8::internal::compiler::ObjectRef::AsJSObject() const+0x65) [0x7f6efa1bf575]
    d8-linux-debug-v8-component-95248/libv8.so(v8::internal::maglev::MaglevGraphBuilder::InferHasInPrototypeChain(v8::internal::maglev::ValueNode*, v8::internal::compiler::HeapObjectRef)+0x13a) [0x7f6ef963038a]
    d8-linux-debug-v8-component-95248/libv8.so(v8::internal::maglev::MaglevGraphBuilder::BuildHasInPrototypeChain(v8::internal::maglev::ValueNode*, v8::internal::compiler::HeapObjectRef)+0x1c) [0x7f6ef963071c]
    d8-linux-debug-v8-component-95248/libv8.so(v8::internal::maglev::MaglevGraphBuilder::TryBuildFastOrdinaryHasInstance(v8::internal::maglev::ValueNode*, v8::internal::compiler::JSObjectRef, v8::internal::maglev::ValueNode*)+0x278) [0x7f6ef9630aa8]
    d8-linux-debug-v8-component-95248/libv8.so(v8::internal::maglev::MaglevGraphBuilder::BuildOrdinaryHasInstance(v8::internal::maglev::ValueNode*, v8::internal::compiler::JSObjectRef, v8::internal::maglev::ValueNode*)+0x22) [0x7f6ef961d892]
    d8-linux-debug-v8-component-95248/libv8.so(v8::internal::maglev::MaglevGraphBuilder::TryBuildFastInstanceOf(v8::internal::maglev::ValueNode*, v8::internal::compiler::JSObjectRef, v8::internal::maglev::ValueNode*)+0x438) [0x7f6ef9630f48]
    d8-linux-debug-v8-component-95248/libv8.so(v8::internal::maglev::MaglevGraphBuilder::TryBuildFastInstanceOfWithFeedback(v8::internal::maglev::ValueNode*, v8::internal::maglev::ValueNode*, v8::internal::compiler::FeedbackSource)+0x163) [0x7f6ef9631943]
    d8-linux-debug-v8-component-95248/libv8.so(v8::internal::maglev::MaglevGraphBuilder::VisitTestInstanceOf()+0xa0) [0x7f6ef9631a00]
    d8-linux-debug-v8-component-95248/libv8.so(v8::internal::maglev::MaglevGraphBuilder::VisitSingleBytecode()+0xd7a) [0x7f6ef951dcaa]
    d8-linux-debug-v8-component-95248/libv8.so(v8::internal::maglev::MaglevGraphBuilder::BuildBody()+0x12a) [0x7f6ef951907a]
    d8-linux-debug-v8-component-95248/libv8.so(v8::internal::maglev::MaglevGraphBuilder::Build()+0x3bb) [0x7f6ef9515eab]
    d8-linux-debug-v8-component-95248/libv8.so(v8::internal::maglev::MaglevCompiler::Compile(v8::internal::LocalIsolate*, v8::internal::maglev::MaglevCompilationInfo*)+0x6d0) [0x7f6ef9514910]
    d8-linux-debug-v8-component-95248/libv8.so(v8::internal::maglev::MaglevCompilationJob::ExecuteJobImpl(v8::internal::RuntimeCallStats*, v8::internal::LocalIsolate*)+0x66) [0x7f6ef95de6c6]
    d8-linux-debug-v8-component-95248/libv8.so(v8::internal::OptimizedCompilationJob::ExecuteJob(v8::internal::RuntimeCallStats*, v8::internal::LocalIsolate*)+0x8d) [0x7f6ef83b5f1d]
    d8-linux-debug-v8-component-95248/libv8.so(v8::internal::maglev::MaglevConcurrentDispatcher::JobTask::Run(v8::JobDelegate*)+0x39b) [0x7f6ef95e041b]
    d8-linux-debug-v8-component-95248/libv8_libplatform.so(v8::platform::DefaultJobWorker::Run()+0xd3) [0x7f6efb1dc883]
    d8-linux-debug-v8-component-95248/libv8_libplatform.so(v8::platform::DefaultWorkerThreadsTaskRunner::WorkerThread::Run()+0xcc) [0x7f6efb1decbc]
    d8-linux-debug-v8-component-95248/libv8_libbase.so(+0x497f8) [0x7f6ef59f37f8]
    /lib/x86_64-linux-gnu/libc.so.6(+0x94ac3) [0x7f6ef5294ac3]
    /lib/x86_64-linux-gnu/libc.so.6(+0x126850) [0x7f6ef5326850]
[6]    1307572 trace trap  d8-linux-debug-v8-component-95248/d8 poc.js

The report lists the tested V8 version as 11.9.0 - 12.0.0. The reproduction is two steps: fetch a debug build of d8 from the given bucket path, then run the proof-of-concept script against it.

  1. Download debug v8 from: gs://v8-asan/linux-debug/d8-linux-debug-v8-component-95248.zip
  2. Run: d8 poc.js

The crash type is listed as 'tab'. The report does not include the contents of poc.js, so the exact JavaScript that triggers the confusion is not shown here. It also does not describe a fix commit or the patched behaviour.

Root cause

The report points to the Maglev optimising compiler's fast path for instanceof. When the graph builder sees a TestInstanceOf bytecode with suitable feedback, it tries to replace the generic operation with a fast ordinary-has-instance check that walks the prototype chain. That path assumes the right-hand side is a JSObject and calls AsJSObject() on the heap reference. The assertion shows that assumption does not hold: an object that is not a JSObject reaches the check. The introduction links this class of bug to the addition of wasm arrays and structs, but the report does not identify the object that reaches the fast path. The report does not name the exact missing check.

Impact

The report demonstrates a debug assertion failure and a tab crash. A type confusion in an optimising compiler can in principle lead to memory corruption in release builds, but that step is not shown in this text.

How this kind of bug works

A type confusion arises when code treats a value as one type while it is actually another. In an engine, the optimising compiler relies on feedback collected at runtime to specialise operations: it records that a call site or operator usually sees a particular shape or map, then emits code that skips the generic checks. If the feedback or the guard is incomplete, a value of a different type can flow into the specialised code. The specialised code then reads fields at offsets that belong to the assumed type, and the two layouts disagree.

In this case the disagreement is between WebAssembly objects and JavaScript objects. Wasm GC objects have their own layouts and maps, and they can appear in JavaScript code as values. Any fast path that assumes "object means JSObject" is wrong once wasm objects can reach it. The defence is a correct type guard before the fast path is taken, plus a bailout to the generic implementation when the guard fails. Debug builds catch these mistakes early with assertions; release builds do not, which is why the same bug can be a crash in debug and a memory-safety issue in release.

How to test for it

  1. Target the boundary between two object models: wasm GC values used from JavaScript, JavaScript objects passed into wasm, and built-ins that inspect object internals such as instanceof, prototype walks, property access and Object helpers.
  2. Build a debug or assertion-enabled engine so that wrong-type assumptions fail loudly instead of silently corrupting memory.
  3. Write small scripts that put an unexpected object type into an operation the optimiser specialises, then run the operation enough times for the optimiser to compile it. Mixing wasm structs and arrays with ordinary objects in the same call site is the pattern to try.
  4. A positive result is an assertion failure or crash whose stack points at a compiler fast path, or a release-build misbehaviour that disappears when optimisation is disabled.
  5. Common false positives: crashes caused by invalid wasm input, out-of-memory conditions, or bugs in the test harness rather than the engine. Confirm by checking that the same script behaves correctly with the optimiser off and that the stack names a specific fast path.

How it is fixed

In compiler terms, the graph builder must verify the object's map or instance type before calling AsJSObject(), and the feedback that drives specialisation must be invalidated when a different type appears. Regression tests should cover wasm objects reaching instanceof and similar operations.

Hunting notes

This class of bug tends to hide where two type systems meet: wasm GC and JavaScript, JIT fast paths and inline caches, and built-ins that assume a particular internal layout. Recon signals include recent engine features (new object kinds, new bytecodes), compiler code paths that call cast helpers, and assertions in debug builds. To make a report accepted, show a minimal reproducer, the exact build and version, the crash or misbehaviour with a stack trace, and a clear statement of which assumption failed. If you can show release-build impact beyond a crash, say so precisely; if you cannot, describe the crash and let the severity follow from the affected component.

The original is short, so this covers everything it reports, then explains this kind of bug in general: how it works, how to test for it and how it is fixed. The general sections are about the bug class, not this target. Written with AI and checked against the original; the original is the record. 10 min read.

What happened, in plain words

This is a public bug report from Google's Chrome Vulnerability Reward Program (VRP), a scheme that pays people for finding and reporting security flaws in Chrome. The researcher, Zhenghang Xiao (@Kipreyyy), found a bug in V8, the JavaScript engine inside Chrome. V8 is the part of the browser that reads and runs the JavaScript code on every web page you visit. The bug is tracked as CVE-2024-7550, a public identifier given to a specific security flaw so people can refer to it unambiguously. The platform records it as high severity, affecting V8, with a bounty of 7,000 USD, disclosed on 6 August 2024.

The report is short. It gives a crash log, a version range and a two-step reproduction, but no deep analysis and no working exploit.

The researcher describes the bug as another case of confusion between WebAssembly and JavaScript objects. WebAssembly, or wasm, is a second language that browsers can run alongside JavaScript, used for heavy computation. It has its own kinds of objects, called wasm arrays and wasm structs. The researcher traces this class of bug back to the moment those wasm object kinds were added to the engine. That is all the introduction says; the report does not explain which exact operation mixes the two object kinds.

The crash

The crash is a debug assertion in a part of V8 called Maglev. Maglev is an optimising compiler: it watches code as it runs and rewrites the hot parts into faster machine code. A debug build is a version of the engine compiled with extra checks that shout loudly when something impossible happens. The check that failed is IsJSObject(), in heap-refs.cc, line 1127, reached from ObjectRef::AsJSObject(). In plain terms, the compiler picked up an object and assumed it was a JavaScript object, then checked, and the check said no.

Bash
#
# Fatal error in ../../src/compiler/heap-refs.cc, line 1127
# Debug check failed: IsJSObject().
#
#
#
#FailureMessage Object: 0x7f6ebeffb250
==== C stack trace ===============================

    d8-linux-debug-v8-component-95248/libv8_libbase.so(v8::base::debug::StackTrace::StackTrace()+0x13) [0x7f6ef59f4aa3]
    d8-linux-debug-v8-component-95248/libv8_libplatform.so(+0x19add) [0x7f6efb1ddadd]
    d8-linux-debug-v8-component-95248/libv8_libbase.so(V8_Fatal(char const*, int, char const*, ...)+0x194) [0x7f6ef59d6234]
    d8-linux-debug-v8-component-95248/libv8_libbase.so(+0x2bc55) [0x7f6ef59d5c55]
    d8-linux-debug-v8-component-95248/libv8.so(v8::internal::compiler::ObjectRef::AsJSObject() const+0x65) [0x7f6efa1bf575]
    d8-linux-debug-v8-component-95248/libv8.so(v8::internal::maglev::MaglevGraphBuilder::InferHasInPrototypeChain(v8::internal::maglev::ValueNode*, v8::internal::compiler::HeapObjectRef)+0x13a) [0x7f6ef963038a]
    d8-linux-debug-v8-component-95248/libv8.so(v8::internal::maglev::MaglevGraphBuilder::BuildHasInPrototypeChain(v8::internal::maglev::ValueNode*, v8::internal::compiler::HeapObjectRef)+0x1c) [0x7f6ef963071c]
    d8-linux-debug-v8-component-95248/libv8.so(v8::internal::maglev::MaglevGraphBuilder::TryBuildFastOrdinaryHasInstance(v8::internal::maglev::ValueNode*, v8::internal::compiler::JSObjectRef, v8::internal::maglev::ValueNode*)+0x278) [0x7f6ef9630aa8]
    d8-linux-debug-v8-component-95248/libv8.so(v8::internal::maglev::MaglevGraphBuilder::BuildOrdinaryHasInstance(v8::internal::maglev::ValueNode*, v8::internal::compiler::JSObjectRef, v8::internal::maglev::ValueNode*)+0x22) [0x7f6ef961d892]
    d8-linux-debug-v8-component-95248/libv8.so(v8::internal::maglev::MaglevGraphBuilder::TryBuildFastInstanceOf(v8::internal::maglev::ValueNode*, v8::internal::compiler::JSObjectRef, v8::internal::maglev::ValueNode*)+0x438) [0x7f6ef9630f48]
    d8-linux-debug-v8-component-95248/libv8.so(v8::internal::maglev::MaglevGraphBuilder::TryBuildFastInstanceOfWithFeedback(v8::internal::maglev::ValueNode*, v8::internal::maglev::ValueNode*, v8::internal::compiler::FeedbackSource)+0x163) [0x7f6ef9631943]
    d8-linux-debug-v8-component-95248/libv8.so(v8::internal::maglev::MaglevGraphBuilder::VisitTestInstanceOf()+0xa0) [0x7f6ef9631a00]
    d8-linux-debug-v8-component-95248/libv8.so(v8::internal::maglev::MaglevGraphBuilder::VisitSingleBytecode()+0xd7a) [0x7f6ef951dcaa]
    d8-linux-debug-v8-component-95248/libv8.so(v8::internal::maglev::MaglevGraphBuilder::BuildBody()+0x12a) [0x7f6ef951907a]
    d8-linux-debug-v8-component-95248/libv8.so(v8::internal::maglev::MaglevGraphBuilder::Build()+0x3bb) [0x7f6ef9515eab]
    d8-linux-debug-v8-component-95248/libv8.so(v8::internal::maglev::MaglevCompiler::Compile(v8::internal::LocalIsolate*, v8::internal::maglev::MaglevCompilationInfo*)+0x6d0) [0x7f6ef9514910]
    d8-linux-debug-v8-component-95248/libv8.so(v8::internal::maglev::MaglevCompilationJob::ExecuteJobImpl(v8::internal::RuntimeCallStats*, v8::internal::LocalIsolate*)+0x66) [0x7f6ef95de6c6]
    d8-linux-debug-v8-component-95248/libv8.so(v8::internal::OptimizedCompilationJob::ExecuteJob(v8::internal::RuntimeCallStats*, v8::internal::LocalIsolate*)+0x8d) [0x7f6ef83b5f1d]
    d8-linux-debug-v8-component-95248/libv8.so(v8::internal::maglev::MaglevConcurrentDispatcher::JobTask::Run(v8::JobDelegate*)+0x39b) [0x7f6ef95e041b]
    d8-linux-debug-v8-component-95248/libv8_libplatform.so(v8::platform::DefaultJobWorker::Run()+0xd3) [0x7f6efb1dc883]
    d8-linux-debug-v8-component-95248/libv8_libplatform.so(v8::platform::DefaultWorkerThreadsTaskRunner::WorkerThread::Run()+0xcc) [0x7f6efb1decbc]
    d8-linux-debug-v8-component-95248/libv8_libbase.so(+0x497f8) [0x7f6ef59f37f8]
    /lib/x86_64-linux-gnu/libc.so.6(+0x94ac3) [0x7f6ef5294ac3]
    /lib/x86_64-linux-gnu/libc.so.6(+0x126850) [0x7f6ef5326850]
[6]    1307572 trace trap  d8-linux-debug-v8-component-95248/d8 poc.js

The stack trace is the list of function calls that led to the crash, read from bottom to top. The bottom lines are the operating system starting the program. Above them, the engine's worker thread runs a Maglev compilation job. The graph builder visits a TestInstanceOf bytecode, which is the internal instruction behind JavaScript's instanceof operator (the operator that asks "is this object an instance of that class?"). It tries to build a fast version of instanceof (TryBuildFastInstanceOf, BuildOrdinaryHasInstance, TryBuildFastOrdinaryHasInstance), then calls BuildHasInPrototypeChain and InferHasInPrototypeChain, which walk the prototype chain, the chain of parent objects a JavaScript object inherits from. At that point it holds a heap object reference, assumes it is a JSObject, and asserts that it is one. The assertion fails, so the object reaching the prototype-chain check is not a JSObject.

The report lists the tested V8 version as 11.9.0 - 12.0.0. The reproduction is two steps: fetch a debug build of d8, the standalone command-line shell for V8, from the given bucket path, then run the proof-of-concept script against it.

  1. Download debug v8 from: gs://v8-asan/linux-debug/d8-linux-debug-v8-component-95248.zip
  2. Run: d8 poc.js

The first step matters because a debug build turns silent wrong assumptions into loud failures. The second runs the script that triggers the bug. The crash type is listed as 'tab'. The report does not include the contents of poc.js, so the exact JavaScript that triggers the confusion is not shown, and it does not describe a fix commit or the patched behaviour.

Why it happens

The report points to Maglev's fast path for instanceof. When the graph builder sees a TestInstanceOf bytecode with suitable feedback, it tries to replace the generic operation with a fast ordinary-has-instance check that walks the prototype chain. That path assumes the right-hand side is a JSObject and calls AsJSObject() on the heap reference. The assertion shows that assumption does not hold: an object that is not a JSObject reaches the check. The introduction links this class of bug to the addition of wasm arrays and structs, but the report does not identify the object that reaches the fast path.

Impact

The report demonstrates a debug assertion failure and a tab crash. A type confusion in an optimising compiler can in principle lead to memory corruption in release builds, but that step is not shown in this text.

In general, how this kind of bug works

A type confusion arises when code treats a value as one type while it is actually another. Think of a form that asks for a passport number and gets a phone number: the box is the same, the meaning is not. In an engine, the optimising compiler relies on feedback collected at runtime to specialise operations: it records that a call site or operator usually sees a particular shape, then emits code that skips the generic checks. If the feedback or the guard is incomplete, a value of a different type can flow into the specialised code. The specialised code then reads fields at offsets that belong to the assumed type, and the two layouts disagree.

In this case the disagreement is between WebAssembly objects and JavaScript objects. Wasm GC objects have their own layouts, and they can appear in JavaScript code as values. Any fast path that assumes "object means JSObject" is wrong once wasm objects can reach it. The defence is a correct type guard before the fast path is taken, plus a bailout to the generic implementation when the guard fails. Debug builds catch these mistakes early with assertions; release builds do not, which is why the same bug can be a crash in debug and a memory-safety issue in release.

How to test for it

  1. Target the boundary between two object models: wasm GC values used from JavaScript, JavaScript objects passed into wasm, and built-ins that inspect object internals such as instanceof, prototype walks, property access and Object helpers.
  2. Build a debug or assertion-enabled engine so that wrong-type assumptions fail loudly instead of silently corrupting memory.
  3. Write small scripts that put an unexpected object type into an operation the optimiser specialises, then run the operation enough times for the optimiser to compile it. Mixing wasm structs and arrays with ordinary objects in the same call site is the pattern to try.
  4. A positive result is an assertion failure or crash whose stack points at a compiler fast path, or a release-build misbehaviour that disappears when optimisation is disabled.
  5. Common false positives: crashes caused by invalid wasm input, out-of-memory conditions, or bugs in the test harness rather than the engine. Confirm by checking that the same script behaves correctly with the optimiser off and that the stack names a specific fast path.

How it is fixed

In compiler terms, the graph builder must verify the object's map or instance type before calling AsJSObject(), and the feedback that drives specialisation must be invalidated when a different type appears. Regression tests should cover wasm objects reaching instanceof and similar operations.

Hunting notes

This class of bug tends to hide where two type systems meet: wasm GC and JavaScript, JIT fast paths and inline caches, and built-ins that assume a particular internal layout. Recon signals include recent engine features (new object kinds, new bytecodes), compiler code paths that call cast helpers, and assertions in debug builds. To make a report accepted, show a minimal reproducer, the exact build and version, the crash or misbehaviour with a stack trace, and a clear statement of which assumption failed. If you can show release-build impact beyond a crash, say so precisely; if you cannot, describe the crash and let the severity follow from the affected component.

Glossary

  • V8: the JavaScript engine inside Chrome that reads and runs JavaScript code.
  • WebAssembly (wasm): a second language browsers can run alongside JavaScript, used for heavy computation.
  • Wasm array / wasm struct: object kinds introduced by WebAssembly's garbage-collected extension, with their own internal layouts.
  • CVE: a public identifier given to a specific security flaw.
  • Chrome VRP: Google's Vulnerability Reward Program, which pays for reported security flaws.
  • Bounty: the money paid for a valid report.
  • Severity: a rating of how serious a bug is, here high.
  • Type confusion: a bug where code treats a value as one type while it is actually another.
  • Maglev: an optimising compiler in V8 that rewrites hot code into faster machine code.
  • JIT (just-in-time) compiler: a compiler that turns code into machine code while the program runs.
  • Bytecode: the internal instruction format V8 uses before compiling to machine code.
  • instanceof: the JavaScript operator that asks whether an object is an instance of a class.
  • Prototype chain: the chain of parent objects a JavaScript object inherits from.
  • JSObject: V8's internal type for a plain JavaScript object.
  • Heap object: any object stored in the engine's managed memory, the heap.
  • Assertion / debug check: a check compiled into debug builds that fails loudly when something impossible happens.
  • Debug build: a version of the engine compiled with extra checks.
  • Release build: the normal version shipped to users, without those extra checks.
  • d8: the standalone command-line shell for V8.
  • Stack trace: the list of function calls that led to a crash, read from bottom to top.
  • Feedback / inline cache: runtime records of what types an operation usually sees, used to specialise code.
  • Fast path: a specialised, quicker code route taken when assumptions hold.
  • Bailout: falling back from a fast path to the generic implementation.
  • Memory corruption: a bug where a program reads or writes memory it should not, potentially letting an attacker take control.
  • Sandbox escape: breaking out of the browser's isolation layer to reach the rest of the system.
  • Proof of concept (PoC): a small script that demonstrates a bug.
  • Regression test: a test added to make sure a fixed bug stays fixed.

More by Zhenghang Xiao

View all

10 more disclosed reports, best first.

More from Google Chrome

View all

The newest disclosed reports for this program.

Similar reports

View all

Same bug class and techniques, clearest first.

Memory corruption

The lesson behind this report.

Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.