Skip to content
Memory corruption Advisory Advanced CVE-2025-13230

Type Confusion in V8 (CVE-2025-13230)

A missing exactness check at the JavaScript-to-WebAssembly boundary allowed a WebAssembly object to be treated as an exact supertype even when it was a subtype, enabling type confusion between unrelated struct types. An attacker could use this to achieve an arbitrary write within the sandbox and, combined with a separate V8 sandbox bypass, remote code execution.

Seunghyun Lee Follow

Originally disclosed on Chrome VRP

Bounty$55,000 High View original
  • Fix shipped in 40 days

VULNERABILITY DETAILS

Summary

Wasm type confusion due to missing exactness check on JS-to-Wasm boundary. JSToWasmObject() allows subtyping even for exact types, leading to type confusion when a descriptor is invalidly typed as an exact supertype and is used to instantiate a described struct.

Custom descriptors feature is exposed in the wild by default through Origin Trials from M141, which is currently at Beta and very soon reaches (Early) Stable. This bug is not caused by a recent code change and has existed from the very first feature implementation (approx. 6 months).

Details

WebAssembly Custom Descriptors proposal introduces exactness as part of heaptype. An object may only be typed as exact if it is exactly an instance of that type, but not for its subtypes. This is due to issues around descriptor subtyping and struct instantiation with upcasted descriptors, as traditional Wasm subtyping semantics will allow instantiating a described object with an upcasted descriptor (supertype struct), then downcasting it (subtype struct) which should be illegal. This issue is resolved by introducing exact types as part of heaptypes.

As exactness is now part of heaptype, this means that each and every type conversions must take exactness into account. However, at JS-to-Wasm boundary this is ignored and traditional subtyping rules are allowed even for exact types:

CC
// https://source.chromium.org/chromium/chromium/src/+/main:v8/src/wasm/wasm-objects.cc;drc=e75b1ba2a99aa352048745d44754c5de8be273d8;l=3656
MaybeDirectHandle<Object> JSToWasmObject(Isolate* isolate,
                                         DirectHandle<Object> value,
                                         CanonicalValueType expected,
                                         const char** error_message) {
  // ...
  switch (expected.heap_representation_non_shared()) {
    // ...
    default: {
      DCHECK(expected.has_index());
      CanonicalTypeIndex canonical_index = expected.ref_index();
      auto type_canonicalizer = GetWasmEngine()->type_canonicalizer();

      if (WasmExportedFunction::IsWasmExportedFunction(*value)) {
        // ...
      } else if (WasmJSFunction::IsWasmJSFunction(*value)) {
        // ...
      } else if (WasmCapiFunction::IsWasmCapiFunction(*value)) {
        // ...
      } else if (IsWasmStruct(*value) || IsWasmArray(*value)) {
        DirectHandle<WasmObject> wasm_obj = Cast<WasmObject>(value);
        Tagged<WasmTypeInfo> type_info = wasm_obj->map()->wasm_type_info();
        CanonicalTypeIndex actual_type = type_info->type_index();
        if (!type_canonicalizer->IsCanonicalSubtype(actual_type,                // [!] ignores exactness and allows any subtypes 
                                                    canonical_index)) {
          *error_message = "object is not a subtype of expected type";
          return {};
        }
        return value;
      } else {
        *error_message = "JS object does not match expected wasm type";
        return {};
      }
    }
  }
}

This pokes a hole in the type system exactly as described in the proposal docs, allowing attackers to invalidly type a descriptor A into an exact supertype B, instantiate a struct described by B, then invalidly cast it to another described struct that is described by A. This leads to type confusion between arbitrary Wasm types.

Bisect

Bug introduced by WebAssembly Custom Descriptors, on Origin Trials from M141 and onwards.

VERSION

Chrome Version: M141~
Operating System: All

REPRODUCTION CASE

Attached as poc.js which exploits this issue to alias two unrelated struct types, then uses this type confusion to trigger an arbitrary caged write within the sandbox.

Also attached is rce.html which exploits this issue, together with the wrapper-wasmcpt-uaf v8sbx bypass, to gain RCE and print out /flag/flag to stdout.

You might want to pass --experimental-wasm-custom-descriptors on d8 or --enable-blink-features=WebAssemblyCustomDescriptors on Chrome to simulate Origin Trials behavior.

FOR CRASHES, PLEASE INCLUDE THE FOLLOWING ADDITIONAL INFORMATION

Type of crash: Renderer
Crash State: Crashes on arbitrary caged write attempt from JIT-compiled Wasm function with poc.js / RCE with rce.html

CREDIT INFORMATION

Reporter credit: Seunghyun Lee (@0x10n) of CMU CSD / CyLab

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

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 6 min read.

Context

V8 is Chrome's JavaScript and WebAssembly engine. The WebAssembly Custom Descriptors proposal adds a new kind of heap type to Wasm: a descriptor type that describes the layout of a struct, so that a struct can be instantiated from a descriptor rather than from a statically declared type. The proposal also introduces exactness as part of a heaptype. An object may only be typed as exact if it is exactly an instance of that type, not an instance of one of its subtypes.

Exactness exists for a specific reason. Under traditional Wasm subtyping, a described object could be instantiated with an upcasted descriptor (a supertype struct) and then downcast to a subtype struct, which should be illegal. Marking the heaptype exact closes that hole. Because exactness is now part of the heaptype, every type conversion in the engine has to take it into account.

The feature was exposed in the wild by default through Origin Trials from M141, which at the time of the report was at Beta and about to reach (Early) Stable. The bug was not caused by a recent code change: it had existed since the very first implementation of the feature, roughly six months.

Setup

The report describes a single-engine bug, so the setup is minimal:

  • Target: V8 inside Google Chrome, version M141 and later, on all operating systems.
  • Feature state: WebAssembly Custom Descriptors enabled through Origin Trials.
  • To reproduce outside Chrome, run d8 with --experimental-wasm-custom-descriptors.
  • To reproduce in Chrome, launch it with --enable-blink-features=WebAssemblyCustomDescriptors to simulate the Origin Trials behaviour.
  • Two attachments accompany the report: poc.js, which aliases two unrelated struct types and triggers an arbitrary caged write inside the sandbox, and rce.html, which combines the bug with a separate V8 sandbox bypass named wrapper-wasmcpt-uaf to gain RCE and print /flag/flag to stdout.

Finding it

The researcher looked at the JS-to-Wasm boundary, specifically at JSToWasmObject(), the function that validates a JavaScript value against the Wasm type expected at a call boundary. The relevant branch handles WasmStruct and WasmArray values. It reads the actual canonical type index from the object's WasmTypeInfo and then asks the type canonicalizer whether that actual type is a canonical subtype of the expected type:

CC
// https://source.chromium.org/chromium/chromium/src/+/main:v8/src/wasm/wasm-objects.cc;drc=[redacted];l=3656
MaybeDirectHandle<Object> JSToWasmObject(Isolate* isolate,
                                         DirectHandle<Object> value,
                                         CanonicalValueType expected,
                                         const char** error_message) {
  // ...
  switch (expected.heap_representation_non_shared()) {
    // ...
    default: {
      DCHECK(expected.has_index());
      CanonicalTypeIndex canonical_index = expected.ref_index();
      auto type_canonicalizer = GetWasmEngine()->type_canonicalizer();

      if (WasmExportedFunction::IsWasmExportedFunction(*value)) {
        // ...
      } else if (WasmJSFunction::IsWasmJSFunction(*value)) {
        // ...
      } else if (WasmCapiFunction::IsWasmCapiFunction(*value)) {
        // ...
      } else if (IsWasmStruct(*value) || IsWasmArray(*value)) {
        DirectHandle<WasmObject> wasm_obj = Cast<WasmObject>(value);
        Tagged<WasmTypeInfo> type_info = wasm_obj->map()->wasm_type_info();
        CanonicalTypeIndex actual_type = type_info->type_index();
        if (!type_canonicalizer->IsCanonicalSubtype(actual_type,                // [!] ignores exactness and allows any subtypes
                                                    canonical_index)) {
          *error_message = "object is not a subtype of expected type";
          return {};
        }
        return value;
      } else {
        *error_message = "JS object does not match expected wasm type";
        return {};
      }
    }
  }
}

The check uses IsCanonicalSubtype(actual_type, canonical_index), which applies ordinary subtyping rules. It never inspects whether the expected type is exact. So a value whose actual type is a subtype of an exact expected type passes the check, even though exactness requires the actual type to be identical to the expected one. The researcher noted that this pokes a hole in the type system exactly as described in the proposal documentation on exact types.

Exploitation

Step 1: obtain a descriptor typed as an exact supertype

Because JSToWasmObject() accepts any subtype of the expected type, a descriptor A can be passed across the JS-to-Wasm boundary where an exact supertype B is expected. The descriptor is now invalidly typed as an exact supertype.

Step 2: instantiate a struct described by the supertype

With the mis-typed descriptor in hand, the attacker instantiates a struct described by B. The engine believes the resulting object is exactly of type B, because the descriptor was accepted as exact.

Step 3: cast to a struct described by the subtype

The object is then invalidly cast to another described struct that is described by A. Under correct exactness semantics this cast should be impossible, since the object was never an instance of A. The result is type confusion between arbitrary Wasm types.

Step 4: turn the confusion into memory corruption

The attached poc.js uses this aliasing of two unrelated struct types to trigger an arbitrary caged write from a JIT-compiled Wasm function. The recorded crash state is a renderer crash on an arbitrary caged write attempt from a JIT-compiled Wasm function.

Step 5: escape the sandbox

The attached rce.html goes further. It combines the type confusion with the wrapper-wasmcpt-uaf V8 sandbox bypass to gain RCE and print /flag/flag to stdout. The attached rce.html combines the type confusion with the wrapper-wasmcpt-uaf V8 sandbox bypass to gain RCE and print /flag/flag to stdout.

Root cause

The Custom Descriptors proposal makes exactness part of the heaptype, so every type conversion must respect it. JSToWasmObject() does not. Its struct and array branch reduces the whole check to IsCanonicalSubtype(actual_type, canonical_index), which is the traditional subtyping relation and is blind to the exact bit on the expected type. Any subtype of an exact type is therefore accepted at the JS-to-Wasm boundary.

The check applies the traditional subtyping relation and does not take exactness into account. The bug is not a regression from a recent change: it has been present since the first implementation of the feature, about six months before the report. The feature reached users by default through Origin Trials from M141, so the window was not limited to flag-enabled builds.

Impact

An attacker who can run JavaScript in a renderer with WebAssembly Custom Descriptors enabled can use the missing exactness check to confuse arbitrary Wasm types. The report demonstrates two outcomes:

  • poc.js: an arbitrary caged write within the V8 sandbox, crashing the renderer on the write attempt from JIT-compiled Wasm code.
  • rce.html: remote code execution when chained with the wrapper-wasmcpt-uaf sandbox bypass, printing /flag/flag to stdout.

The precondition is the feature being active, which from M141 happens by default through Origin Trials rather than only behind a flag. The RCE outcome additionally depends on the separate sandbox bypass being available.

Fix

The report does not describe the patch. What it establishes is the requirement: the JS-to-Wasm conversion must take exactness into account, so that a value is accepted for an exact expected type only when its actual type is that exact type, and subtyping is permitted only for non-exact expected types.

Variants to test

  1. Other JS-to-Wasm entry points. Any API that converts a JS value into a Wasm reference type (table set, global set, imported function arguments, WebAssembly.Function construction) should be tested with an exact expected type and a subtype value. A positive result is the call succeeding where it should throw a type error.
  2. Exactness on arrays and functions. Repeat the descriptor trick with array types and with function reference types, not just structs. A positive result is an object of the wrong exact type being accepted and later observable through a cast.
  3. Cross-boundary round trips. Pass a mis-typed descriptor into Wasm, instantiate, return the object to JS, and pass it back through another boundary. A positive result is the object retaining the wrong type identity across the round trip.
  4. Other engines implementing the proposal. Run the same descriptor and exact-type patterns against any other engine that ships Custom Descriptors. A positive result is the same acceptance of a subtype where an exact type is required.
  5. Canonicalization edge cases. Test types that canonicalize to the same index through different declaration paths, combined with exactness. A positive result is a subtype check passing between types that should be distinct under exactness rules.

Written with AI from the full original report and checked against it passage by passage; anything it could not back up was removed or toned down. The original is the record. 14 min read.

What happened, in plain words

Chrome runs JavaScript and WebAssembly inside a component called V8. WebAssembly (often shortened to Wasm) is a way to run programs written in other languages, such as C++ or Rust, inside the browser at near-native speed. V8 is the part of Chrome that reads and executes both JavaScript and Wasm.

A new feature for Wasm, called Custom Descriptors, was being rolled out to ordinary Chrome users. It lets a program describe the shape of a piece of data (a struct) at runtime, using a descriptor, instead of fixing that shape in the code ahead of time. The feature also introduced a rule called exactness: some types are marked as exact, meaning a value is allowed to be that type only if it is precisely that type, never a more specific variant of it.

Exactness exists to close a loophole. Without it, a program could build an object using a general descriptor and then pretend it was a more specific type, which should not be allowed. The rule is simple: if a type is exact, only that exact type is acceptable.

The bug is that one checkpoint in V8, the place where a value crosses from JavaScript into Wasm, forgot to apply the exactness rule. It only asked "is this value a subtype of the expected type?" and never asked "is the expected type exact?". So a value of a more specific type slipped through where only the exact type should have been accepted. That let the researcher make V8 confuse two unrelated types, which is the classic start of a memory-corruption attack.

The bug was not new. It had been in the code since the feature was first written, about six months before the report. From Chrome version M141 the feature was being offered to normal users through a mechanism called Origin Trials, so the problem was not limited to people who had switched on special developer flags.

The researcher attached two files. One, poc.js, proves the type confusion and turns it into an unauthorised write inside a protected memory area. The other, rce.html, goes further: it combines the bug with a separate weakness to run arbitrary code and print the contents of a file called /flag/flag.

Background: the pieces involved

Before the details, here are the ideas you need. Each one is explained from scratch.

  • V8: Chrome's engine for JavaScript and WebAssembly. Think of it as the interpreter that turns the code on a web page into actions on your computer.
  • WebAssembly (Wasm): a compact, fast format for programs that can run in the browser. It is often produced by compiling languages like C++ or Rust. It runs in a restricted environment, but bugs in the engine that runs it can still be serious.
  • Struct: a bundle of named fields, like a small record with a fixed layout. In Wasm, the layout of a struct is part of its type.
  • Descriptor: in the Custom Descriptors proposal, a value that describes the layout of a struct, so the struct can be created from the descriptor at runtime rather than from a type fixed in the program text.
  • Subtype and supertype: a subtype is a more specific version of a type; a supertype is the more general one. A "cat" is a subtype of "animal". Code that accepts an animal should also accept a cat.
  • Exact type: a type marked so that only values of precisely that type are allowed, not subtypes. If a function expects an exact "animal", a cat is not acceptable, because a cat is not exactly an animal.
  • Type confusion: a class of bug where the program treats a value as one type when it is really another. The program then reads or writes memory using the wrong layout, which can corrupt data or crash.
  • JS-to-Wasm boundary: the checkpoint where a value created in JavaScript is handed to Wasm code. Because the two languages have different type systems, the engine must check that the value matches what the Wasm side expects.
  • Origin Trials: a Chrome mechanism that lets a new web feature be switched on by default for a limited group of sites or users before it is fully launched. It is how the Custom Descriptors feature reached ordinary users from M141.
  • Sandbox: a protective boundary around the engine. Even if an attacker corrupts memory inside the sandbox, they should not be able to reach the rest of the browser or the operating system without a second bug that breaks out.
  • RCE (remote code execution): the ability for an attacker to make the target machine run code of their choosing. It is the most severe outcome in browser security.
  • JIT (just-in-time compiler): a component that translates code into machine instructions while the program runs, for speed. A JIT-compiled Wasm function is one that has been turned into native machine code.

The setup

The report describes a bug in a single engine, so the setup is small.

  1. Target: V8 inside Google Chrome, version M141 and later, on all operating systems.
  2. Feature state: WebAssembly Custom Descriptors switched on through Origin Trials.
  3. To reproduce outside Chrome: run d8, the standalone V8 shell, with the flag --experimental-wasm-custom-descriptors.
  4. To reproduce in Chrome: launch it with --enable-blink-features=WebAssemblyCustomDescriptors, which simulates the Origin Trials behaviour.
  5. Attachments: poc.js, which makes two unrelated struct types overlap and triggers an unauthorised write inside the sandbox, and rce.html, which combines the bug with a separate V8 sandbox bypass named wrapper-wasmcpt-uaf to gain RCE and print /flag/flag to standard output.

A flag here is a command-line switch that changes how the program behaves, usually for testing. d8 is a small command-line program that runs JavaScript and Wasm using V8 without a full browser, which makes experiments easier.

Finding the bug

The researcher looked at the JS-to-Wasm boundary, specifically at a function called JSToWasmObject(). This function is the guard: it receives a JavaScript value and the Wasm type that the Wasm side expects, and it decides whether the value is acceptable. If it is not, it returns an error message instead of the value.

The interesting branch is the one that handles Wasm structs and arrays. It reads the value's real type from internal metadata, then asks a helper called the type canonicalizer whether that real type is a subtype of the expected type. The canonicalizer is the part of the engine that decides when two type declarations mean the same thing, so that identical types written in different places are treated as one.

Here is the relevant code, copied from the report:

CC
// https://source.chromium.org/chromium/chromium/src/+/main:v8/src/wasm/wasm-objects.cc;drc=[redacted];l=3656
MaybeDirectHandle<Object> JSToWasmObject(Isolate* isolate,
                                         DirectHandle<Object> value,
                                         CanonicalValueType expected,
                                         const char** error_message) {
  // ...
  switch (expected.heap_representation_non_shared()) {
    // ...
    default: {
      DCHECK(expected.has_index());
      CanonicalTypeIndex canonical_index = expected.ref_index();
      auto type_canonicalizer = GetWasmEngine()->type_canonicalizer();

      if (WasmExportedFunction::IsWasmExportedFunction(*value)) {
        // ...
      } else if (WasmJSFunction::IsWasmJSFunction(*value)) {
        // ...
      } else if (WasmCapiFunction::IsWasmCapiFunction(*value)) {
        // ...
      } else if (IsWasmStruct(*value) || IsWasmArray(*value)) {
        DirectHandle<WasmObject> wasm_obj = Cast<WasmObject>(value);
        Tagged<WasmTypeInfo> type_info = wasm_obj->map()->wasm_type_info();
        CanonicalTypeIndex actual_type = type_info->type_index();
        if (!type_canonicalizer->IsCanonicalSubtype(actual_type,                // [!] ignores exactness and allows any subtypes
                                                    canonical_index)) {
          *error_message = "object is not a subtype of expected type";
          return {};
        }
        return value;
      } else {
        *error_message = "JS object does not match expected wasm type";
        return {};
      }
    }
  }
}

Line by line, in plain words:

  • The comment line points to the exact file and revision on the Chromium source site, so anyone can look at the same code.
  • MaybeDirectHandle<Object> JSToWasmObject(...) declares the function. It returns either a value or nothing (the Maybe part), and it takes four inputs: the engine instance (isolate), the JavaScript value to check, the expected Wasm type, and a place to store an error message.
  • switch (expected.heap_representation_non_shared()) looks at what kind of reference the expected type is. The // ... hides cases not relevant here.
  • default: is the branch for reference types that carry a type index, which includes structs and arrays.
  • DCHECK(expected.has_index()); is a debug-only assertion that the expected type really has an index.
  • CanonicalTypeIndex canonical_index = expected.ref_index(); pulls out the expected type's canonical index, a number that identifies the type after canonicalization.
  • auto type_canonicalizer = GetWasmEngine()->type_canonicalizer(); fetches the helper that knows the subtype relationships between canonical types.
  • The chain of if and else if checks what kind of value was passed: an exported Wasm function, a JavaScript function wrapped for Wasm, a C API function, or a struct or array. The first three branches are elided with // ....
  • else if (IsWasmStruct(*value) || IsWasmArray(*value)) is the branch that matters for this bug: the value is a Wasm struct or array.
  • DirectHandle<WasmObject> wasm_obj = Cast<WasmObject>(value); treats the value as a Wasm object.
  • Tagged<WasmTypeInfo> type_info = wasm_obj->map()->wasm_type_info(); reads the object's internal type information.
  • CanonicalTypeIndex actual_type = type_info->type_index(); gets the canonical index of the value's real type.
  • if (!type_canonicalizer->IsCanonicalSubtype(actual_type, canonical_index)) is the flawed check. It asks only whether the real type is a subtype of the expected type. The comment marks the problem: it ignores exactness and allows any subtypes.
  • If the check fails, the function sets the error message "object is not a subtype of expected type" and returns nothing.
  • If the check passes, it returns the value unchanged.
  • The final else handles values that are not Wasm objects at all, setting "JS object does not match expected wasm type".

The key line is IsCanonicalSubtype(actual_type, canonical_index). It applies ordinary subtyping, the same rule that would be correct for a non-exact type. It never looks at whether the expected type is exact. So a value whose real type is a subtype of an exact expected type passes, even though exactness says the real type must be identical. The researcher noted that this opens a hole in the type system exactly as described in the proposal's documentation on exact types.

Exploitation

Exploitation means turning the bug into a concrete effect. The report breaks it into steps.

Step 1: obtain a descriptor typed as an exact supertype

Because JSToWasmObject() accepts any subtype of the expected type, a descriptor A can be passed across the JS-to-Wasm boundary where an exact supertype B is expected. The descriptor is now wrongly labelled as an exact supertype. In everyday terms: a form asks for an exact "vehicle" and you hand over a "car", and the clerk accepts it because a car is a kind of vehicle, even though the form said exact.

Step 2: instantiate a struct described by the supertype

With the mis-typed descriptor in hand, the attacker creates a struct described by B. The engine believes the resulting object is exactly of type B, because the descriptor was accepted as exact.

Step 3: cast to a struct described by the subtype

The object is then cast to another described struct that is described by A. Under correct exactness rules this cast should be impossible, because the object was never an instance of A in the engine's books. The result is type confusion between arbitrary Wasm types: the same memory is now viewed through two different layouts.

Step 4: turn the confusion into memory corruption

The attached poc.js uses this overlap of two unrelated struct types to trigger an unauthorised write from a JIT-compiled Wasm function, inside the sandbox's protected memory area (the "cage"). The recorded crash state is a renderer crash on an arbitrary caged write attempt from a JIT-compiled Wasm function. A renderer is the Chrome process that handles a single tab; crashing it is bad but contained, which is why the write is described as inside the sandbox.

Step 5: escape the sandbox

The attached rce.html goes further. It combines the type confusion with the wrapper-wasmcpt-uaf V8 sandbox bypass to gain RCE and print /flag/flag to standard output. The attached rce.html combines the type confusion with the wrapper-wasmcpt-uaf V8 sandbox bypass to gain RCE and print /flag/flag to standard output. Chaining means using one bug to set up another, like using a first key to reach a second lock.

Root cause

The Custom Descriptors proposal makes exactness part of the type, so every type conversion must respect it. JSToWasmObject() does not. Its struct and array branch reduces the whole check to IsCanonicalSubtype(actual_type, canonical_index), which is the traditional subtyping relation and is blind to the exact bit on the expected type. Any subtype of an exact type is therefore accepted at the JS-to-Wasm boundary.

The check applies the traditional subtyping relation and does not take exactness into account. The bug is not a regression from a recent change: it has been present since the first implementation of the feature, about six months before the report. The feature reached users by default through Origin Trials from M141, so the window was not limited to builds with special flags.

Impact

An attacker who can run JavaScript in a renderer with WebAssembly Custom Descriptors enabled can use the missing exactness check to confuse arbitrary Wasm types. The report demonstrates two outcomes:

  • poc.js: an unauthorised write inside the V8 sandbox, crashing the renderer on the write attempt from JIT-compiled Wasm code.
  • rce.html: remote code execution when chained with the wrapper-wasmcpt-uaf sandbox bypass, printing /flag/flag to standard output.

The precondition is the feature being active, which from M141 happens by default through Origin Trials rather than only behind a flag. The RCE outcome additionally depends on the separate sandbox bypass being available.

Fix

The report does not describe the patch. What it establishes is the requirement: the JS-to-Wasm conversion must take exactness into account, so that a value is accepted for an exact expected type only when its real type is that exact type, and subtyping is permitted only for non-exact expected types.

Variants to test

These are follow-up experiments a security researcher would try, to see whether the same mistake appears elsewhere.

  1. Other JS-to-Wasm entry points. Any API that converts a JavaScript value into a Wasm reference type (setting a table entry, setting a global, passing arguments to an imported function, constructing a WebAssembly.Function) should be tested with an exact expected type and a subtype value. A positive result is the call succeeding where it should throw a type error.
  2. Exactness on arrays and functions. Repeat the descriptor trick with array types and with function reference types, not just structs. A positive result is an object of the wrong exact type being accepted and later observable through a cast.
  3. Cross-boundary round trips. Pass a mis-typed descriptor into Wasm, create the object, return it to JavaScript, and pass it back through another boundary. A positive result is the object keeping the wrong type identity across the round trip.
  4. Other engines implementing the proposal. Run the same descriptor and exact-type patterns against any other engine that ships Custom Descriptors. A positive result is the same acceptance of a subtype where an exact type is required.
  5. Canonicalization edge cases. Test types that canonicalize to the same index through different declaration paths, combined with exactness. A positive result is a subtype check passing between types that should be distinct under exactness rules.

Glossary

  • API: a defined set of functions and rules that one piece of software offers to another, like a service counter with a fixed list of things you can ask for.
  • Array (Wasm): an ordered sequence of values of one type, with a layout that is part of its type.
  • Bisect: narrowing down when a bug was introduced, often by testing versions one by one.
  • Bounty: a payment made by a software vendor to a researcher who reports a security bug.
  • Canonicalization: deciding when two type declarations written in different places mean the same type, so they can share one internal identity.
  • Canonical type index: the number that identifies a type after canonicalization.
  • Cast: telling the program to treat a value as a particular type. A wrong cast is how type confusion becomes memory corruption.
  • Cage: the reserved region of memory inside which the V8 sandbox keeps engine objects.
  • Chaining: combining two or more bugs so that one sets up the conditions for the next.
  • Crash state: the recorded description of what the program was doing when it crashed.
  • Custom Descriptors: a WebAssembly proposal that lets a struct be described at runtime by a descriptor value, and adds exact types.
  • d8: the standalone command-line shell that runs JavaScript and Wasm on top of V8 without a browser.
  • Descriptor: a value that describes the layout of a struct so the struct can be created from it at runtime.
  • Exact type: a type marked so that only values of precisely that type are accepted, not subtypes.
  • Flag: a command-line switch that changes how a program behaves, usually for testing.
  • Heap type: in Wasm, the part of a reference type that says what kind of thing the reference points to.
  • JIT (just-in-time compiler): a component that turns code into machine instructions while the program runs, for speed.
  • JS-to-Wasm boundary: the checkpoint where a value from JavaScript is handed to Wasm code and must be type-checked.
  • M141: a Chrome version number. From this version the feature was offered through Origin Trials.
  • Origin Trials: a Chrome mechanism that lets a new web feature be switched on by default for a limited group before full launch.
  • poc.js: the proof-of-concept file attached to the report that demonstrates the type confusion and the in-sandbox write.
  • RCE (remote code execution): making the target machine run code of the attacker's choosing.
  • rce.html: the attached file that chains the bug with a sandbox bypass to gain RCE.
  • Renderer: the Chrome process that handles one tab's page content.
  • Sandbox: a protective boundary around the engine so that memory corruption inside it does not automatically reach the rest of the browser or the operating system.
  • Sandbox bypass: a separate bug that lets an attacker get past the sandbox boundary.
  • Standard output (stdout): the normal text output channel of a program, usually the terminal or console.
  • Struct: a bundle of fields with a fixed layout, whose layout is part of its type in Wasm.
  • Subtype / supertype: a subtype is a more specific type, a supertype a more general one; a cat is a subtype of animal.
  • Type confusion: a bug where a value is treated as one type while it is really another, so memory is read or written with the wrong layout.
  • Type error: an error raised when a value does not match the type a function or operation requires.
  • Wasm: short for WebAssembly, a fast binary format for programs that run in the browser.
  • WasmTypeInfo: the internal metadata attached to a Wasm object that records its type.
  • wrapper-wasmcpt-uaf: the name given in the report to a separate V8 sandbox bypass used in the RCE chain.

More by Seunghyun Lee

View all

14 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.