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

Type Confusion in V8 (CVE-2024-1939)

A crash was found in V8's WebAssembly runtime, likely a type confusion, where accessing a value in Runtime_WasmGenericWasmToJSObject causes a segmentation fault. The reporter could only demonstrate a crash in a debug build of d8, not a working exploit.

Bohan Liu Follow

Originally disclosed on Chrome VRP

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

From comment #2

I have reported this at https://issues.chromium.org/issues/323699953 with another templete. Just in case, I reissue again using the security bug. It seems that I can't change the component to "Blink>JavaScript>WebAssembly". Feel free to merge them, Thanks!

VULNERABILITY DETAILS Please provide a brief explanation of the security issue. The bug seems to be an issue in wasm, maybe a type confusion. It crashes at Runtime_WasmGenericWasmToJSObject, when accessing the value it causes a segment fault.

C++
RUNTIME_FUNCTION(Runtime_WasmGenericWasmToJSObject) {
  HandleScope scope(isolate);
  DCHECK_EQ(1, args.length());
  Handle<Object> value(args[0], isolate);
  if (IsWasmInternalFunction(*value)) {
    Handle<WasmInternalFunction> internal =
        Handle<WasmInternalFunction>::cast(value);
    return *WasmInternalFunction::GetOrCreateExternal(internal);
  }
  if (IsWasmNull(*value)) return ReadOnlyRoots(isolate).null_value();
  return *value;
}

VERSION v8 Version: commit e1610ada22658dcac81976d83c3912a66867ce52 Operating System: Ubuntu

REPRODUCTION CASE Please include a demonstration of the security bug, such as an attached HTML or binary file that reproduces the bug when loaded in Chrome. PLEASE make the file as small as possible and remove any content not required to demonstrate the bug, or any personal or confidential information.

Please attach files directly, not in zip or other archive formats, and if you've created a demonstration site please also attach the files needed to reproduce the demonstration locally.

I can reproduce the issue stablely in Ubuntu 64 bit which cross-compiles the d8 in arm. First compile the d8 with the gn in attachment. Run the attached file in d8 , it will crash at Runtime_WasmGenericWasmToJSObject.

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

// Received signal 11 SEGV_MAPERR 00008f7c0004
//
// ==== C stack trace ===============================
//
//  [0x000056db07b9]
//  [0x0000f7fccb70]
//  [0x0000574fcf4c]
//  [0x000058e3619d]
//  [0x000058e35bf0]
//  [0x000059246a97]
//  [0x0000592417bf]
//  [0x0000592655d5]
//  [0x000059265c06]
//  [0x000057428e66]
//  [0x00005742cad4]
//  [0x000056ddce0b]
//  [0x000056ddc6df]
//  [0x000056cb8a95]
//  [0x000056cda8c6]
//  [0x000056ce0180]
//  [0x000056cdf971]
//  [0x000056ce32ce]
//  [0x0000f7c79ed5]
//  [0x000056c7f191]
// [end of stack trace]
the backtrace is :
#0  v8::base::Flags<v8::internal::MemoryChunkHeader::Flag, unsigned int, unsigned int>::operator&(v8::base::Flags<v8::internal::MemoryChunkHeader::Flag, unsigned int, unsigned int> const&) const () at ../../src/base/flags.h:58
#1  0x566dc2a9 in v8::base::Flags<v8::internal::MemoryChunkHeader::Flag, unsigned int, unsigned int>::operator&(v8::internal::MemoryChunkHeader::Flag) const () at ../../src/base/flags.h:78
#2  0x566dc225 in v8::internal::MemoryChunkHeader::IsFlagSet(v8::internal::MemoryChunkHeader::Flag) const () at ../../src/heap/memory-chunk-header.h:153
#3  0xf3358029 in v8::internal::MemoryChunkHeader::InReadOnlySpace() const () at ../../src/heap/memory-chunk-header.h:196
#4  0xf3357ff4 in v8::internal::IsReadOnlyHeapObject(v8::internal::Tagged<v8::internal::HeapObject>) () at ../../src/heap/heap-write-barrier-inl.h:244
#5  0xf3ae8cfe in v8::internal::HandleBase::IsDereferenceAllowed() const () at ../../src/handles/handles.cc:61
#6  0x566207a1 in v8::internal::Handle<v8::internal::Object>::operator*() const () at ../../src/handles/handles.h:162
#7  0xf56510f3 in v8::internal::__RT_impl_Runtime_WasmGenericWasmToJSObject(v8::internal::RuntimeArgumentsWithoutHandles, v8::internal::Isolate*) () at ../../src/runtime/runtime-wasm.cc:137
#8  0xf5650cee in v8::internal::Runtime_WasmGenericWasmToJSObject(int, unsigned int*, v8::internal::Isolate*) () at ../../src/runtime/runtime-wasm.cc:133
warning: Could not find DWO CU obj/v8_base_without_compiler/simulator-arm.dwo(0x3071c7d02b646ee6) referenced by CU at offset 0x63cc [in module /home/p4nda/fuzz/v8/out/arm.debug/libv8.so]
#9  0xf5c9b518 in v8::internal::UnsafeGenericFunctionCall(int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int) () at ../../src/execution/arm/simulator-arm.cc:1651
args.gn

The original report as published on the Chromium issue tracker, by Bohan Liu (@P4nda20371774) of Tencent Security Xuanwu Lab. 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

This is a V8 bug, filed through the Chrome VRP and tracked as CVE-2024-1939, with a high severity rating and a bounty of 7000.00 USD. The researcher is Bohan Liu (@P4nda20371774) of Tencent Security Xuanwu Lab, and the report was disclosed on 2024-02-27.

The affected component is V8's WebAssembly support. The crash happens in the runtime function Runtime_WasmGenericWasmToJSObject, which is the path V8 uses when a WebAssembly function value has to be converted into a JavaScript-visible object. The researcher's own description is cautious: the bug seems to be an issue in wasm, maybe a type confusion. The crash occurs when the runtime accesses the value and hits a segmentation fault.

The report was reissued through the security bug template after an earlier filing at https://issues.chromium.org/issues/323699953 used a different template. The researcher notes that the component could not be changed to "Blink>JavaScript>WebAssembly" and asks for the two reports to be merged.

Setup

The reproduction was done against a specific V8 commit:

Text
v8 Version: commit [redacted]
Operating System: Ubuntu

The researcher reproduced the issue stably on 64-bit Ubuntu, using a d8 build cross-compiled for arm. The d8 binary is compiled with gn using the args.gn attached to the report. The reproduction file attached to the report is then run in d8, and it crashes at Runtime_WasmGenericWasmToJSObject.

Finding it

The starting point is the runtime function itself. The researcher quotes it in full:

C++
RUNTIME_FUNCTION(Runtime_WasmGenericWasmToJSObject) {
  HandleScope scope(isolate);
  DCHECK_EQ(1, args.length());
  Handle<Object> value(args[0], isolate);
  if (IsWasmInternalFunction(*value)) {
    Handle<WasmInternalFunction> internal =
        Handle<WasmInternalFunction>::cast(value);
    return *WasmInternalFunction::GetOrCreateExternal(internal);
  }
  if (IsWasmNull(*value)) return ReadOnlyRoots(isolate).null_value();
  return *value;
}

The function takes a single argument, wraps it in a handle, and then dereferences it to test IsWasmInternalFunction. If the value is a wasm internal function it converts it to the external form; if it is wasm null it returns the null value; otherwise it returns the value unchanged. The backtrace shows the fault inside the handle dereference, in HandleBase::IsDereferenceAllowed. The researcher's assessment is that the bug seems to be in wasm, maybe a type confusion.

Exploitation

Step 1: build d8 for arm

Compile d8 with gn using the attached args.gn, cross-compiling for arm from 64-bit Ubuntu. The report does not reproduce the contents of args.gn.

Step 2: run the reproduction file

Run the attached file in the resulting d8. The report does not include the file's contents. The result is a crash in Runtime_WasmGenericWasmToJSObject.

Step 3: observe the crash

The crash type field in the report says tab. The crash state begins with a segmentation fault:

Text
// Received signal 11 SEGV_MAPERR 00008f7c0004
//
// ==== C stack trace ===============================
//
//  [0x000056db07b9]
//  [0x0000f7fccb70]
//  [0x0000574fcf4c]
//  [0x000058e3619d]
//  [0x000058e35bf0]
//  [0x000059246a97]
//  [0x0000592417bf]
//  [0x0000592655d5]
//  [0x000059265c06]
//  [0x000057428e66]
//  [0x00005742cad4]
//  [0x000056ddce0b]
//  [0x000056ddc6df]
//  [0x000056cb8a95]
//  [0x000056cda8c6]
//  [0x000056ce0180]
//  [0x000056cdf971]
//  [0x000056ce32ce]
//  [0x0000f7c79ed5]
//  [0x000056c7f191]
// [end of stack trace]

The signal is 11, SEGV_MAPERR, at address 00008f7c0004. The researcher also provides a symbolised backtrace:

Text
#0  v8::base::Flags<v8::internal::MemoryChunkHeader::Flag, unsigned int, unsigned int>::operator&(v8::base::Flags<v8::internal::MemoryChunkHeader::Flag, unsigned int, unsigned int> const&) const () at ../../src/base/flags.h:58
#1  0x566dc2a9 in v8::base::Flags<v8::internal::MemoryChunkHeader::Flag, unsigned int, unsigned int>::operator&(v8::internal::MemoryChunkHeader::Flag) const () at ../../src/base/flags.h:78
#2  0x566dc225 in v8::internal::MemoryChunkHeader::IsFlagSet(v8::internal::MemoryChunkHeader::Flag) const () at ../../src/heap/memory-chunk-header.h:153
#3  0xf3358029 in v8::internal::MemoryChunkHeader::InReadOnlySpace() const () at ../../src/heap/memory-chunk-header.h:196
#4  0xf3357ff4 in v8::internal::IsReadOnlyHeapObject(v8::internal::Tagged<v8::internal::HeapObject>) () at ../../src/heap/heap-write-barrier-inl.h:244
#5  0xf3ae8cfe in v8::internal::HandleBase::IsDereferenceAllowed() const () at ../../src/handles/handles.cc:61
#6  0x566207a1 in v8::internal::Handle<v8::internal::Object>::operator*() const () at ../../src/handles/handles.h:162
#7  0xf56510f3 in v8::internal::__RT_impl_Runtime_WasmGenericWasmToJSObject(v8::internal::RuntimeArgumentsWithoutHandles, v8::internal::Isolate*) () at ../../src/runtime/runtime-wasm.cc:137
#8  0xf5650cee in v8::internal::Runtime_WasmGenericWasmToJSObject(int, unsigned int*, v8::internal::Isolate*) () at ../../src/runtime/runtime-wasm.cc:133
warning: Could not find DWO CU obj/v8_base_without_compiler/simulator-arm.dwo(0x3071c7d02b646ee6) referenced by CU at offset 0x63cc [in module /home/p4nda/fuzz/v8/out/arm.debug/libv8.so]
#9  0xf5c9b518 in v8::internal::UnsafeGenericFunctionCall(int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int) () at ../../src/execution/arm/simulator-arm.cc:1651
args.gn

The backtrace runs from frame 9, UnsafeGenericFunctionCall in the arm simulator, down to frame 0 in flags.h. Frames 8 and 7 are the runtime function itself, at runtime-wasm.cc:133 and runtime-wasm.cc:137. Frame 6 is the handle dereference, Handle<Object>::operator*. Frame 5 is HandleBase::IsDereferenceAllowed, which is where V8 checks whether the handle may be dereferenced. Frame 4 is IsReadOnlyHeapObject, frame 3 is MemoryChunkHeader::InReadOnlySpace, frame 2 is MemoryChunkHeader::IsFlagSet, and frames 1 and 0 are the flag bit test in flags.h. The backtrace passes through IsDereferenceAllowed, IsReadOnlyHeapObject and MemoryChunkHeader::InReadOnlySpace before the flag test in flags.h.

Root cause

The report does not identify the precise defect that produces the bad value. What it establishes is that the crash occurs in Runtime_WasmGenericWasmToJSObject when the value is accessed, with the backtrace passing through the handle dereference and read-only-space check. The researcher's assessment is that the bug is in wasm and is possibly a type confusion, meaning the runtime is given a value of one type where another is expected, so the checks that follow the dereference never get a chance to reject it.

Why the existing checks did not stop it is not stated in the report. The report does not say why the existing checks did not stop the crash. Whether the type confusion originates in the wasm compiler, the call path into the runtime, or the representation of the value passed as the argument is not determined here.

Impact

The report's crash type field says tab, and the crash is a segmentation fault seen when running the reproduction in d8. The researcher describes the issue as a possible type confusion in wasm, but the report itself demonstrates only the crash and does not show exploitation. The bounty and severity rating reflect the platform's assessment, not a demonstrated primitive in the text.

Fix

The report does not describe a fix or a patch. It asks for the duplicate filings to be merged and leaves the component classification to the maintainers.

Variants to test

  1. Exercise other runtime entry points that take a wasm value and convert it to a JavaScript object, and check whether any of them dereference the argument before validating its type. A positive result is a crash in the same IsDereferenceAllowed or read-only-space path rather than in the conversion logic.
  2. Try wasm null and wasm internal function values at the boundaries of the conversion, including values produced by cross-compiled arm builds under the simulator. A positive result is a fault address in the same range pattern as SEGV_MAPERR on an unmapped chunk header.
  3. Run the same reproduction under different build configurations and architectures to see whether the crash depends on the arm simulator path shown in frame 9. A positive result is the same backtrace shape on a native build, which would rule out a simulator-only artefact.

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. 16 min read.

What happened, in plain words

A security researcher found a way to make Chrome's JavaScript engine, V8, crash in a way that suggests something deeper than a simple bug. V8 is the part of Chrome that reads and runs JavaScript, the programming language most websites use. It also runs WebAssembly, usually shortened to wasm, which is a second language that browsers understand: it is designed to run very fast, and developers often compile code from other languages into wasm so it can run in a browser.

The crash happened in a specific internal function called Runtime_WasmGenericWasmToJSObject. That function's job is to take a value that came out of WebAssembly and hand it back to JavaScript in a form JavaScript can use. When the researcher ran the reproduction, V8 crashed with a segmentation fault while accessing the value. A segmentation fault, often written as segfault, is what happens when a program tries to read or write a piece of the computer's memory that it is not allowed to touch. The operating system stops the program immediately to protect everything else.

The researcher's own words are careful: the bug seems to be an issue in wasm, maybe a type confusion. A type confusion is a class of bug where a program treats a piece of data as one kind of thing when it is actually another kind, a bit like reading a phone number as if it were a price. Type confusions matter because, in the wrong hands, they can sometimes be turned into something worse than a crash, such as running attacker-controlled code. This report, though, only demonstrates the crash.

The report was filed through the Chrome Vulnerability Reward Program, usually called the Chrome VRP, which is Google's scheme for paying people who report security bugs in Chrome. The bug was given the identifier CVE-2024-1939. CVE stands for Common Vulnerabilities and Exposures: it is a public catalogue number that lets everyone refer to the same bug unambiguously. The severity was rated high, and the bounty paid was 7000.00 USD. The researcher is Bohan Liu (@P4nda20371774) of Tencent Security Xuanwu Lab, and the report was disclosed on 2024-02-27.

One administrative detail matters for understanding the report's shape. The researcher had already filed the same issue once before, at https://issues.chromium.org/issues/323699953, using a different template. A template here means the standard form a bug tracker asks you to fill in, with fields such as version, reproduction steps and crash information. The researcher re-filed it using the security bug template, and noted that the component field could not be changed to "Blink>JavaScript>WebAssembly". Components are the labels a tracker uses to route a bug to the right team. The researcher asked for the two reports to be merged, so the maintainers would not end up with two copies of the same issue.

The setup

The reproduction was done against one specific version of V8, identified by a commit hash:

Text
v8 Version: commit [redacted]
Operating System: Ubuntu

Line by line:

  • v8 Version: commit [redacted] gives the exact snapshot of the V8 source code that was tested. V8 is developed in a version control system called git, and every saved change is a commit with a long identifier made of letters and digits. Quoting the commit means anyone can check out exactly the same code and try to reproduce the crash. Without it, a bug report can become useless within days, because the code keeps changing.
  • Operating System: Ubuntu says the machine used was running Ubuntu, a popular free Linux distribution. The operating system matters because crashes can depend on how memory is laid out, and that differs between systems.

The researcher reproduced the issue stably on 64-bit Ubuntu. The build used was d8 cross-compiled for arm. Two terms need unpacking:

  • d8 is V8's own small command-line program. It is a bare JavaScript and WebAssembly shell, with no browser window, no tabs and no web page around it. Developers use it because it starts fast and lets you run a single script directly, which makes testing the engine much easier than driving a whole browser.
  • Cross-compiling means building a program on one kind of machine so that it runs on a different kind. Here the build happened on a 64-bit Ubuntu machine but produced an arm build. Arm is a family of processor designs used in many phones and other devices. To run arm code on a non-arm machine, V8 includes a simulator, a piece of software that pretends to be an arm processor instruction by instruction.

The d8 binary was compiled with gn, which is the tool Google uses to generate build files, using an args.gn file attached to the report. An args.gn file is simply a settings file that tells the build which options to switch on. The report does not reproduce its contents. The reproduction file attached to the report is then run in d8, and it crashes at Runtime_WasmGenericWasmToJSObject. The report does not include that file's contents either.

Finding it

The starting point is the runtime function itself. A runtime function is an internal helper inside V8 that the engine can call while it is running code; the name Runtime_ is a naming convention for these helpers. The researcher quotes it in full:

C++
RUNTIME_FUNCTION(Runtime_WasmGenericWasmToJSObject) {
  HandleScope scope(isolate);
  DCHECK_EQ(1, args.length());
  Handle<Object> value(args[0], isolate);
  if (IsWasmInternalFunction(*value)) {
    Handle<WasmInternalFunction> internal =
        Handle<WasmInternalFunction>::cast(value);
    return *WasmInternalFunction::GetOrCreateExternal(internal);
  }
  if (IsWasmNull(*value)) return ReadOnlyRoots(isolate).null_value();
  return *value;
}

This is C++, the language V8 is written in. Line by line, in plain words:

  • RUNTIME_FUNCTION(Runtime_WasmGenericWasmToJSObject) { starts the definition of the function and gives it its name. The name says what it does: take a wasm value and turn it into a JavaScript object.
  • HandleScope scope(isolate); sets up a small bookkeeping area. A handle is V8's way of keeping track of an object while the garbage collector, the part of the engine that frees memory no longer in use, may move objects around. The handle is a stable reference that survives the move. A HandleScope is the container that cleans up those references when the function finishes. isolate is the name for one independent copy of the V8 engine, with its own memory and state.
  • DCHECK_EQ(1, args.length()); is a debug-only assertion that the function was called with exactly one argument. Assertions are checks a programmer writes to catch mistakes during development; in release builds they are typically compiled out.
  • Handle<Object> value(args[0], isolate); takes the first argument, args[0], and wraps it in a handle called value. From this point on, the code works with the handle rather than the raw value.
  • if (IsWasmInternalFunction(*value)) { asks whether the thing behind the handle is a wasm internal function. The * in front of value means dereference: follow the handle and get the actual object it points to. This is the first moment the code actually touches the object.
  • Handle<WasmInternalFunction> internal = Handle<WasmInternalFunction>::cast(value); if the answer was yes, this re-labels the handle as pointing to a wasm internal function, so the code can use it as that specific type.
  • return *WasmInternalFunction::GetOrCreateExternal(internal); converts the internal function into its external, JavaScript-visible form and returns it.
  • if (IsWasmNull(*value)) return ReadOnlyRoots(isolate).null_value(); handles the special wasm null value, returning the ordinary JavaScript null in its place.
  • return *value; is the fallback: if the value is neither of the above, return it unchanged.

The backtrace shows the fault inside the handle dereference, in HandleBase::IsDereferenceAllowed. The researcher's assessment is that the bug seems to be in wasm, maybe a type confusion. A heap object is an object stored in the heap, the large pool of memory the engine manages for its data.

Reproducing it

Step 1: build d8 for arm

Compile d8 with gn using the attached args.gn, cross-compiling for arm from 64-bit Ubuntu. This step exists because the crash was observed in that particular configuration, and a bug report is only useful if someone else can rebuild the same thing. The report does not reproduce the contents of args.gn.

Step 2: run the reproduction file

Run the attached file in the resulting d8. The report does not include the file's contents. The result is a crash in Runtime_WasmGenericWasmToJSObject. Running a small file in d8 rather than loading a page in Chrome keeps the reproduction minimal: fewer moving parts means fewer places for the behaviour to differ between machines.

Step 3: observe the crash

The crash type field in the report says tab. The crash state begins with a segmentation fault:

Text
// Received signal 11 SEGV_MAPERR 00008f7c0004
//
// ==== C stack trace ===============================
//
//  [0x000056db07b9]
//  [0x0000f7fccb70]
//  [0x0000574fcf4c]
//  [0x000058e3619d]
//  [0x000058e35bf0]
//  [0x000059246a97]
//  [0x0000592417bf]
//  [0x0000592655d5]
//  [0x000059265c06]
//  [0x000057428e66]
//  [0x00005742cad4]
//  [0x000056ddce0b]
//  [0x000056ddc6df]
//  [0x000056cb8a95]
//  [0x000056cda8c6]
//  [0x000056ce0180]
//  [0x000056cdf971]
//  [0x000056ce32ce]
//  [0x0000f7c79ed5]
//  [0x000056c7f191]
// [end of stack trace]

What this block means:

  • Received signal 11 SEGV_MAPERR 00008f7c0004 is the operating system's report of the fault. Signal 11 is the number Linux uses for a segmentation fault. SEGV_MAPERR is the specific reason: the program tried to reach an address that has no memory mapped to it at all. The long hexadecimal number is that address. Hexadecimal is just a way of writing numbers using sixteen digits, common in computing because it lines up neatly with the way memory is addressed.
  • The lines starting with // are comments, text the crash handler prints for humans rather than code.
  • ==== C stack trace =============================== introduces a stack trace. A stack trace is the list of function calls that were in progress at the moment of the crash, innermost first or outermost first depending on the tool. Think of it as the list of steps that led to the accident, like a flight recorder for a program.
  • Each [0x...] line is one address on that stack. On its own, an address is just a number; it only becomes meaningful when it is matched to the source code, which is what the next block does.

The researcher also provides a symbolised backtrace. Symbolised means the raw addresses have been translated back into function names and file locations, using debugging information left in the build:

Text
#0  v8::base::Flags<v8::internal::MemoryChunkHeader::Flag, unsigned int, unsigned int>::operator&(v8::base::Flags<v8::internal::MemoryChunkHeader::Flag, unsigned int, unsigned int> const&) const () at ../../src/base/flags.h:58
#1  0x566dc2a9 in v8::base::Flags<v8::internal::MemoryChunkHeader::Flag, unsigned int, unsigned int>::operator&(v8::internal::MemoryChunkHeader::Flag) const () at ../../src/base/flags.h:78
#2  0x566dc225 in v8::internal::MemoryChunkHeader::IsFlagSet(v8::internal::MemoryChunkHeader::Flag) const () at ../../src/heap/memory-chunk-header.h:153
#3  0xf3358029 in v8::internal::MemoryChunkHeader::InReadOnlySpace() const () at ../../src/heap/memory-chunk-header.h:196
#4  0xf3357ff4 in v8::internal::IsReadOnlyHeapObject(v8::internal::Tagged<v8::internal::HeapObject>) () at ../../src/heap/heap-write-barrier-inl.h:244
#5  0xf3ae8cfe in v8::internal::HandleBase::IsDereferenceAllowed() const () at ../../src/handles/handles.cc:61
#6  0x566207a1 in v8::internal::Handle<v8::internal::Object>::operator*() const () at ../../src/handles/handles.h:162
#7  0xf56510f3 in v8::internal::__RT_impl_Runtime_WasmGenericWasmToJSObject(v8::internal::RuntimeArgumentsWithoutHandles, v8::internal::Isolate*) () at ../../src/runtime/runtime-wasm.cc:137
#8  0xf5650cee in v8::internal::Runtime_WasmGenericWasmToJSObject(int, unsigned int*, v8::internal::Isolate*) () at ../../src/runtime/runtime-wasm.cc:133
warning: Could not find DWO CU obj/v8_base_without_compiler/simulator-arm.dwo(0x3071c7d02b646ee6) referenced by CU at offset 0x63cc [in module /home/p4nda/fuzz/v8/out/arm.debug/libv8.so]
#9  0xf5c9b518 in v8::internal::UnsafeGenericFunctionCall(int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int, int) () at ../../src/execution/arm/simulator-arm.cc:1651
args.gn

Each frame is one function call, numbered from the innermost, where the fault happened, outwards:

  • Frame 9 is UnsafeGenericFunctionCall in the arm simulator, at simulator-arm.cc:1651.
  • Frames 8 and 7 are the runtime function itself, at runtime-wasm.cc:133 and runtime-wasm.cc:137. The two frames exist because the runtime function is a thin wrapper around an implementation function whose name begins with __RT_impl_.
  • Frame 6 is the handle dereference, Handle<Object>::operator*. In C++, operator* is the name of the code that runs when you write *value, so this frame is exactly the *value from the source above.
  • Frame 5 is HandleBase::IsDereferenceAllowed, which is where V8 checks whether the handle may be dereferenced at all. This is a safety check, and it is the check that ends up touching the bad memory.
  • Frame 4 is IsReadOnlyHeapObject, which asks whether the object lives in read-only space. Read-only space is a region of memory V8 reserves for objects that never change, such as built-in constants; because they never change, they can be shared and protected.
  • Frame 3 is MemoryChunkHeader::InReadOnlySpace, frame 2 is MemoryChunkHeader::IsFlagSet, and frames 1 and 0 are the flag bit test in flags.h. A memory chunk header is a small block of bookkeeping data stored just before each chunk of heap memory, recording properties of that chunk. One of those properties is a flag, a single on-or-off bit, saying whether the chunk is read-only.

The backtrace passes through IsDereferenceAllowed, IsReadOnlyHeapObject and MemoryChunkHeader::InReadOnlySpace before the flag test in flags.h. The address being read is not mapped, hence SEGV_MAPERR. In other words, the crash occurred inside the safety check itself.

The line warning: Could not find DWO CU ... is a note from the debugging tools that some separate debug information file was missing. It did not stop the backtrace from being produced. The final line, args.gn, is the name of the attached build settings file, which the report does not reproduce.

Why it happens

The report does not identify the precise defect that produces the bad value. What it establishes is that the crash occurs in Runtime_WasmGenericWasmToJSObject when the value is accessed, with the backtrace passing through the handle dereference and read-only-space check. The researcher's assessment is that the bug is in wasm and is possibly a type confusion, meaning the runtime is given a value of one type where another is expected, so the checks that follow the dereference never get a chance to reject it.

Why the existing checks did not stop it is not stated in the report. The report does not say why the existing checks did not stop the crash. Whether the type confusion originates in the wasm compiler, the call path into the runtime, or the representation of the value passed as the argument is not determined here.

What it means in practice

The report's crash type field says tab, and the crash is a segmentation fault seen when running the reproduction in d8. The renderer is the part of a browser that turns a web page into what you see, and it is deliberately kept separate from the rest of the browser so that a crash there does not take everything down. The researcher describes the issue as a possible type confusion in wasm. Memory corruption means a program's data in memory gets changed in ways the programmer never intended, which is the usual stepping stone towards running an attacker's code. A denial of service, by contrast, just means making something unavailable, for example by crashing it. The report itself demonstrates only the crash and does not show exploitation. The bounty and severity rating reflect the platform's assessment, not a demonstrated primitive in the text.

The fix

The report does not describe a fix or a patch. It asks for the duplicate filings to be merged and leaves the component classification to the maintainers.

Other things worth testing

  1. Exercise other runtime entry points that take a wasm value and convert it to a JavaScript object, and check whether any of them dereference the argument before validating its type. A positive result is a crash in the same IsDereferenceAllowed or read-only-space path rather than in the conversion logic. The reasoning: if one conversion path forgot to validate its input, sibling paths may have the same gap.
  2. Try wasm null and wasm internal function values at the boundaries of the conversion, including values produced by cross-compiled arm builds under the simulator. A positive result is a fault address in the same range pattern as SEGV_MAPERR on an unmapped chunk header. The reasoning: boundary values are where type mix-ups most often show up.
  3. Run the same reproduction under different build configurations and architectures to see whether the crash depends on the arm simulator path shown in frame 9. A positive result is the same backtrace shape on a native build, which would rule out a simulator-only artefact. The reasoning: a bug that only appears under a simulator may be a quirk of the simulator rather than of the engine itself.

Glossary

  • V8: the JavaScript and WebAssembly engine inside Chrome; it reads and runs the code that web pages contain.
  • WebAssembly (wasm): a second language browsers understand, designed for speed, often produced by compiling code written in other languages.
  • Runtime function: an internal helper inside V8 that the engine calls while running code; names beginning with Runtime_ follow this convention.
  • Segmentation fault (segfault): the operating system stopping a program because it tried to access memory it is not allowed to touch.
  • Signal 11: the number Linux uses to report a segmentation fault to a program.
  • SEGV_MAPERR: the specific reason for a segmentation fault where the address being accessed has no memory mapped to it.
  • Hexadecimal: a way of writing numbers using sixteen digits, common in computing for memory addresses.
  • Type confusion: a bug where a program treats data as one kind of thing when it is actually another kind.
  • Memory corruption: unintended changes to a program's data in memory, often a step towards running attacker-controlled code.
  • Denial of service: making something unavailable, for example by crashing it.
  • Heap: the pool of memory an engine manages for its objects.
  • Heap object: an object stored in the heap.
  • Handle: V8's stable reference to an object that may be moved by the garbage collector.
  • HandleScope: the container that cleans up handles when a function finishes.
  • Dereference: following a reference to reach the actual object it points to; written with * in C++.
  • Isolate: one independent copy of the V8 engine, with its own memory and state.
  • Garbage collector: the part of an engine that frees memory no longer in use.
  • Assertion (DCHECK): a check a programmer writes to catch mistakes during development, typically removed from release builds.
  • Commit: a saved change in a version control system such as git, identified by a long string of letters and digits.
  • Ubuntu: a popular free Linux distribution.
  • d8: V8's own small command-line shell for running JavaScript and WebAssembly without a browser.
  • Cross-compiling: building a program on one kind of machine so that it runs on a different kind.
  • Arm: a family of processor designs used in many phones and other devices.
  • Simulator: software that pretends to be a processor of a different kind, instruction by instruction.
  • gn: the tool Google uses to generate build files, configured by an args.gn settings file.
  • Stack trace: the list of function calls in progress at the moment of a crash.
  • Symbolised backtrace: a stack trace where raw addresses have been translated back into function names and source file locations.
  • Frame: one entry in a stack trace, corresponding to one function call.
  • Memory chunk header: bookkeeping data stored before a chunk of heap memory, recording properties of that chunk.
  • Flag: a single on-or-off bit recording a property.
  • Read-only space: a region of memory V8 reserves for objects that never change.
  • Renderer: the part of a browser that turns a web page into what you see, kept separate from the rest of the browser.
  • Tab crash: a crash that takes down one browser tab rather than the whole browser.
  • Chrome VRP: Google's Vulnerability Reward Program, which pays people who report security bugs in Chrome.
  • CVE: Common Vulnerabilities and Exposures, a public catalogue number that lets everyone refer to the same bug unambiguously.
  • Bounty: the payment made for a valid security report.
  • Severity: a rating of how serious a bug is.
  • Template: the standard form a bug tracker asks you to fill in.
  • Component: the label a bug tracker uses to route a bug to the right team.
  • Merge (of reports): combining duplicate filings of the same issue into one.

More by Bohan Liu

View all

1 more disclosed report, 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.