Heap buffer overflow in V8 (CVE-2025-0999)
A heap buffer overflow occurs in V8 when compiling a Wasm-to-JS wrapper for an imported JS function with an arity of 0xfffa or more, causing an out-of-bounds read and potential write in the instruction selector. An attacker could exploit this to corrupt memory outside the V8 sandbox and potentially achieve code execution.
Originally disclosed on Chrome VRP
- Fix shipped in 15 days
VULNERABILITY DETAILS
Summary
Heap memory corruption due to overly large JS parameter count of 0xfffa and above in Wasm-to-JS wrapper tier-up compilation causing out-of-bounds memory access at InstructionSelectorT::InitializeCallBuffer().
Details
When compiling a Wasm-to-JS wrapper where the imported JS function expects an arity of 0xfffa or more, the total argument nodes required goes over the limit of 0xfffe and above:
// https://source.chromium.org/chromium/chromium/src/+/main:v8/src/wasm/wrappers.cc;drc=d18f1fb989fa3f6191bba17495c41cf06b6f4172;l=556
void BuildWasmToJSWrapper(ImportCallKind kind, int expected_arity,
Suspend suspend) {
// ...
int pushed_count = std::max(expected_arity, wasm_count);
// 5 extra arguments: receiver, new target, arg count, dispatch handle and
// context.
bool has_dispatch_handle =
kind == ImportCallKind::kUseCallBuiltin
? false
: V8_JS_LINKAGE_INCLUDES_DISPATCH_HANDLE_BOOL;
base::SmallVector<OpIndex, 16> args(pushed_count + 4 +
(has_dispatch_handle ? 1 : 0));
// ...
This confuses the Turboshaft compiler, where the end result is an out-of-bounds heap memory access in GetVirtualRegister():
// https://source.chromium.org/chromium/chromium/src/+/main:v8/src/compiler/backend/instruction-selector.cc;drc=69de864028e8d11e8d05971253b98229365d4fb0;l=522
template <typename Adapter>
int InstructionSelectorT<Adapter>::GetVirtualRegister(node_t node) {
DCHECK(this->valid(node));
size_t const id = this->id(node); // [!] invalid id returned
DCHECK_LT(id, virtual_registers_.size());
int virtual_register = virtual_registers_[id]; // [!] oob read
if (virtual_register == InstructionOperand::kInvalidVirtualRegister) {
virtual_register = sequence()->NextVirtualRegister();
virtual_registers_[id] = virtual_register; // [!] potential oob write, and broken registers tracking
}
return virtual_register;
}
This is an immediate out-of-v8sbx memory corruption where an attacker can spray target data of virtual_registers_[id] == InstructionOperand::kInvalidVirtualRegister which this vulnerability allows to modify it to a different value. Not only is this the only problem, but the bug will also likely result in a broken compilation result which opens up other avenues of exploitation.
Bisect
TBD
VERSION
Chrome Version: Tested on Chrome M131 ~ M133 (latest stable), d8 ToT
Operating System: All
REPRODUCTION CASE
Attached as wasmtojs-tierup-isel-crash.js which crashes due to OOB access. Also attached is a small wrapper wrapper.html that loads this script in Chrome to demonstrate reproducibility also in Chrome.
Full exploit is TBD.
FOR CRASHES, PLEASE INCLUDE THE FOLLOWING ADDITIONAL INFORMATION
Type of crash: Renderer
Crash State:
$ ./d8-asan-sandbox-testing-linux-release-v8-component-98499/d8 ./wasmtojs-tierup-isel-crash.js
=================================================================
==713021==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x79c88b272f34 at pc 0x5ce6f04cfac5 bp 0x7ffdc4a3e4d0 sp 0x7ffdc4a3e4c8
READ of size 4 at 0x79c88b272f34 thread T0
#0 0x5ce6f04cfac4 in v8::internal::compiler::InstructionSelectorT::GetVirtualRegister(v8::internal::compiler::turboshaft::OpIndex) src/compiler/backend/instruction-selector.cc:543:26
#1 0x5ce6f04d46f7 in v8::internal::compiler::OperandGeneratorT::UseLocation(v8::internal::compiler::turboshaft::OpIndex, v8::internal::LinkageLocation) src/compiler/backend/instruction-selector-impl.h:262:53
#2 0x5ce6f04d396d in v8::internal::compiler::InstructionSelectorT::InitializeCallBuffer(v8::internal::compiler::turboshaft::OpIndex, v8::internal::compiler::CallBufferT*, v8::base::Flags<v8::internal::compiler::InstructionSelectorT::CallBufferFlag, int, int>, int) src/compiler/backend/instruction-selector.cc:1744:31
#3 0x5ce6f04dbdef in v8::internal::compiler::InstructionSelectorT::VisitCall(v8::internal::compiler::turboshaft::OpIndex, v8::internal::compiler::turboshaft::Block*) src/compiler/backend/instruction-selector.cc:2846:3
#4 0x5ce6f04d6374 in v8::internal::compiler::InstructionSelectorT::VisitNode(v8::internal::compiler::turboshaft::OpIndex) src/compiler/backend/instruction-selector.cc:5602:9
#5 0x5ce6f04cdd76 in v8::internal::compiler::InstructionSelectorT::VisitBlock(v8::internal::compiler::turboshaft::Block*) src/compiler/backend/instruction-selector.cc:2031:7
#6 0x5ce6f04cd366 in v8::internal::compiler::InstructionSelectorT::SelectInstructions() src/compiler/backend/instruction-selector.cc:157:5
#7 0x5ce6f0f76b99 in v8::internal::compiler::turboshaft::InstructionSelectionPhase::Run(v8::internal::compiler::turboshaft::PipelineData*, v8::internal::Zone*, v8::internal::compiler::CallDescriptor const*, v8::internal::compiler::Linkage*, v8::internal::CodeTracer*) src/compiler/turboshaft/instruction-selection-phase.cc:359:55
#8 0x5ce6f08eb1e1 in auto v8::internal::compiler::turboshaft::Pipeline::Run<v8::internal::compiler::turboshaft::InstructionSelectionPhase, v8::internal::compiler::CallDescriptor*&, v8::internal::compiler::Linkage*&, v8::internal::CodeTracer*&>(v8::internal::compiler::CallDescriptor*&, v8::internal::compiler::Linkage*&, v8::internal::CodeTracer*&) src/compiler/turboshaft/pipelines.h:88:27
#9 0x5ce6f0880fe6 in v8::internal::compiler::turboshaft::Pipeline::SelectInstructions(v8::internal::compiler::Linkage*) src/compiler/turboshaft/pipelines.h:312:48
#10 0x5ce6f0869beb in v8::internal::compiler::(anonymous namespace)::GenerateCodeFromTurboshaftGraph(v8::internal::compiler::Linkage*, v8::internal::compiler::turboshaft::Pipeline&, v8::internal::compiler::PipelineImpl*, std::__Cr::shared_ptr<v8::internal::compiler::OsrHelper>) src/compiler/pipeline.cc:504:28
#11 0x5ce6f08738dc in v8::internal::compiler::Pipeline::GenerateCodeForWasmNativeStubFromTurboshaft(v8::internal::wasm::CanonicalSig const*, v8::internal::wasm::WrapperCompilationInfo, char const*, v8::internal::AssemblerOptions const&, v8::internal::compiler::SourcePositionTable*) src/compiler/pipeline.cc:3061:26
#12 0x5ce6f19cb9ca in v8::internal::compiler::CompileWasmImportCallWrapper(v8::internal::wasm::ImportCallKind, v8::internal::wasm::CanonicalSig const*, bool, int, v8::internal::wasm::Suspend) src/compiler/wasm-compiler.cc:1729:17
#13 0x5ce6eff41362 in v8::internal::wasm::WasmImportWrapperCache::CompileWasmImportCallWrapper(v8::internal::Isolate*, v8::internal::wasm::ImportCallKind, v8::internal::wasm::CanonicalSig const*, v8::internal::wasm::CanonicalTypeIndex, bool, int, v8::internal::wasm::Suspend) src/wasm/wasm-import-wrapper-cache.cc:158:34
#14 0x5ce6efbc3ebe in __RT_impl_Runtime_TierUpWasmToJSWrapper src/runtime/runtime-wasm.cc:745:24
#15 0x5ce6efbc3ebe in v8::internal::Runtime_TierUpWasmToJSWrapper(int, unsigned long*, v8::internal::Isolate*) src/runtime/runtime-wasm.cc:627:1
#16 0x5ce6f1ba63c8 in Builtins_WasmCEntry setup-isolate-deserialize.cc
#17 0x5ce6f1b9d20b in Builtins_WasmToJsWrapperCSA setup-isolate-deserialize.cc
#18 0x7b788bed2996 (<unknown module>)
#19 0x5ce6f1b9c814 in Builtins_JSToWasmWrapperAsm setup-isolate-deserialize.cc
#20 0x5ce6f1c7e3fd in Builtins_JSToWasmWrapper setup-isolate-deserialize.cc
#21 0x5ce6f1afec74 in Builtins_InterpreterEntryTrampoline setup-isolate-deserialize.cc
#22 0x5ce6f1afc75b in Builtins_JSEntryTrampoline setup-isolate-deserialize.cc
#23 0x5ce6f1afc4aa in Builtins_JSEntry setup-isolate-deserialize.cc
#24 0x5ce6ee6c5f25 in v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) src/execution/execution.cc:437:22
#25 0x5ce6ee6c68c8 in v8::internal::Execution::CallScript(v8::internal::Isolate*, v8::internal::DirectHandle<v8::internal::JSFunction>, v8::internal::DirectHandle<v8::internal::Object>, v8::internal::DirectHandle<v8::internal::Object>) src/execution/execution.cc:537:10
#26 0x5ce6ee296fbc in v8::Script::Run(v8::Local<v8::Context>, v8::Local<v8::Data>) src/api/api.cc:2146:7
#27 0x5ce6ee210593 in v8::Shell::ExecuteString(v8::Isolate*, v8::Local<v8::String>, v8::Local<v8::String>, v8::Shell::ReportExceptions, v8::Global<v8::Value>*) src/d8/d8.cc:1018:44
#28 0x5ce6ee23129f in v8::SourceGroup::Execute(v8::Isolate*) src/d8/d8.cc:4979:10
#29 0x5ce6ee238db7 in v8::Shell::RunMainIsolate(v8::Isolate*, bool) src/d8/d8.cc:5930:37
#30 0x5ce6ee23884c in v8::Shell::RunMain(v8::Isolate*, bool) src/d8/d8.cc:5838:18
#31 0x5ce6ee23ad8d in v8::Shell::Main(int, char**) src/d8/d8.cc:6696:18
#32 0x7b788bc29d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
Address 0x79c88b272f34 is a wild pointer inside of access range of size 0x000000000004.
SUMMARY: AddressSanitizer: heap-buffer-overflow src/compiler/backend/instruction-selector.cc:543:26 in v8::internal::compiler::InstructionSelectorT::GetVirtualRegister(v8::internal::compiler::turboshaft::OpIndex)
Shadow bytes around the buggy address:
0x79c88b272c80: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x79c88b272d00: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x79c88b272d80: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x79c88b272e00: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x79c88b272e80: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
=>0x79c88b272f00: fa fa fa fa fa fa[fa]fa fa fa fa fa fa fa fa fa
0x79c88b272f80: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x79c88b273000: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x79c88b273080: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x79c88b273100: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
0x79c88b273180: fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa fa
Shadow byte legend (one shadow byte represents 8 application bytes):
Addressable: 00
Partially addressable: 01 02 03 04 05 06 07
Heap left redzone: fa
Freed heap region: fd
Stack left redzone: f1
Stack mid redzone: f2
Stack right redzone: f3
Stack after return: f5
Stack use after scope: f8
Global redzone: f9
Global init order: f6
Poisoned by user: f7
Container overflow: fc
Array cookie: ac
Intra object redzone: bb
ASan internal: fe
Left alloca redzone: ca
Right alloca redzone: cb
==713021==ABORTING
CREDIT INFORMATION
Reporter credit: Seunghyun Lee (@0x10n) of CMU CyLab
Initially discovered by a v8sbx fuzzer, which revealed not to be a v8sbx violation but a full-blown memory corruption bug.
Context
V8 is the JavaScript and WebAssembly engine used by Chrome. When WebAssembly code imports a JavaScript function, V8 does not call the JS function directly: it builds a small native stub, a Wasm-to-JS wrapper, that marshals the arguments and performs the call. That wrapper is compiled by Turboshaft, V8's optimising compiler, and can later be tiered up, meaning recompiled with a different import call kind, through the runtime function Runtime_TierUpWasmToJSWrapper.
The wrapper has to reserve space for every argument it will pass. The number of arguments is driven by the arity the imported JS function expects, so a large arity means a large argument list, and the compiler's internal bookkeeping has to cope with it.
This report describes a heap buffer overflow in that path, tracked as CVE-2025-0999, in the V8 component of Google Chrome. It was reported through the Chrome VRP by Seunghyun Lee (@0x10n) of CMU CyLab, rated high severity, and disclosed on 18 February 2025 with a bounty of 11,000 USD.
Setup
The bug was tested on Chrome M131 through M133 (latest stable at the time) and on d8 ToT, on all operating systems. The crash was reproduced with an AddressSanitizer build of d8:
./d8-asan-sandbox-testing-linux-release-v8-component-98499/d8 ./wasmtojs-tierup-isel-crash.js
The reproduction case is a script attached to the report as wasmtojs-tierup-isel-crash.js, which crashes due to the out-of-bounds access. A small wrapper, wrapper.html, loads that script in Chrome to show the same reproducibility in the browser. The report notes that a full exploit was still to be determined, and the bisect section is marked TBD.
Finding it
The bug was initially discovered by a v8sbx fuzzer. On investigation it turned out not to be a v8sbx violation at all, but a full-blown memory corruption bug.
The trigger condition is an imported JS function whose expected arity is 0xfffa or more, compiled as a Wasm-to-JS wrapper during tier-up. At that size the total number of argument nodes required goes over the limit of 0xfffe and above, and the compiler's node identifiers stop being valid for the structures that index them.
Exploitation
Step 1: build the wrapper with an oversized argument list
In BuildWasmToJSWrapper in v8/src/wasm/wrappers.cc, the argument vector is sized from the expected arity:
// https://source.chromium.org/chromium/chromium/src/+/main:v8/src/wasm/wrappers.cc;drc=[redacted];l=556
void BuildWasmToJSWrapper(ImportCallKind kind, int expected_arity,
Suspend suspend) {
// ...
int pushed_count = std::max(expected_arity, wasm_count);
// 5 extra arguments: receiver, new target, arg count, dispatch handle and
// context.
bool has_dispatch_handle =
kind == ImportCallKind::kUseCallBuiltin
? false
: [redacted];
base::SmallVector<OpIndex, 16> args(pushed_count + 4 +
(has_dispatch_handle ? 1 : 0));
// ...
The vector holds pushed_count argument nodes plus four fixed extras (receiver, new target, arg count and context), plus one more for the dispatch handle when the import call kind includes one. With expected_arity at 0xfffa or above, the resulting count exceeds what the rest of the compiler expects.
Step 2: tier-up compilation reaches instruction selection
The crash happens when the wrapper is tiered up. The stack trace shows the path from the runtime entry point down to instruction selection:
The failing call is InstructionSelectorT::InitializeCallBuffer(), reached from VisitCall while selecting instructions for the wrapper's call node.
Step 3: out-of-bounds access in GetVirtualRegister
The faulting function is GetVirtualRegister:
// https://source.chromium.org/chromium/chromium/src/+/main:v8/src/compiler/backend/instruction-selector.cc;drc=[redacted];l=522
template <typename Adapter>
int InstructionSelectorT<Adapter>::GetVirtualRegister(node_t node) {
DCHECK(this->valid(node));
size_t const id = this->id(node); // [!] invalid id returned
DCHECK_LT(id, virtual_registers_.size());
int virtual_register = virtual_registers_[id]; // [!] oob read
if (virtual_register == InstructionOperand::kInvalidVirtualRegister) {
virtual_register = sequence()->NextVirtualRegister();
virtual_registers_[id] = virtual_register; // [!] potential oob write, and broken registers tracking
}
return virtual_register;
}
The node identifier returned by this->id(node) is invalid, so the index into virtual_registers_ falls outside the vector. The read at that index is out of bounds. If the value read happens to equal InstructionOperand::kInvalidVirtualRegister, the function writes a freshly allocated virtual register back to the same out-of-bounds slot, which is a potential out-of-bounds write and leaves the register tracking broken.
Step 4: observe the crash
Running the reproduction script under the ASan build produces:
=================================================================
==713021==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x79c88b272f34 at pc 0x5ce6f04cfac5 bp 0x7ffdc4a3e4d0 sp 0x7ffdc4a3e4c8
READ of size 4 at 0x79c88b272f34 thread T0
#0 0x5ce6f04cfac4 in v8::internal::compiler::InstructionSelectorT::GetVirtualRegister(v8::internal::compiler::turboshaft::OpIndex) src/compiler/backend/instruction-selector.cc:543:26
#1 0x5ce6f04d46f7 in v8::internal::compiler::OperandGeneratorT::UseLocation(v8::internal::compiler::turboshaft::OpIndex, v8::internal::LinkageLocation) src/compiler/backend/instruction-selector-impl.h:262:53
#2 0x5ce6f04d396d in v8::internal::compiler::InstructionSelectorT::InitializeCallBuffer(v8::internal::compiler::turboshaft::OpIndex, v8::internal::compiler::CallBufferT*, v8::base::Flags<v8::internal::compiler::InstructionSelectorT::CallBufferFlag, int, int>, int) src/compiler/backend/instruction-selector.cc:1744:31
#3 0x5ce6f04dbdef in v8::internal::compiler::InstructionSelectorT::VisitCall(v8::internal::compiler::turboshaft::OpIndex, v8::internal::compiler::turboshaft::Block*) src/compiler/backend/instruction-selector.cc:2846:3
#4 0x5ce6f04d6374 in v8::internal::compiler::InstructionSelectorT::VisitNode(v8::internal::compiler::turboshaft::OpIndex) src/compiler/backend/instruction-selector.cc:5602:9
#5 0x5ce6f04cdd76 in v8::internal::compiler::InstructionSelectorT::VisitBlock(v8::internal::compiler::turboshaft::Block*) src/compiler/backend/instruction-selector.cc:2031:7
#6 0x5ce6f04cd366 in v8::internal::compiler::InstructionSelectorT::SelectInstructions() src/compiler/backend/instruction-selector.cc:157:5
#7 0x5ce6f0f76b99 in v8::internal::compiler::turboshaft::InstructionSelectionPhase::Run(v8::internal::compiler::turboshaft::PipelineData*, v8::internal::Zone*, v8::internal::compiler::CallDescriptor const*, v8::internal::compiler::Linkage*, v8::internal::CodeTracer*) src/compiler/turboshaft/instruction-selection-phase.cc:359:55
#8 0x5ce6f08eb1e1 in auto v8::internal::compiler::turboshaft::Pipeline::Run<v8::internal::compiler::turboshaft::InstructionSelectionPhase, v8::internal::compiler::CallDescriptor*&, v8::internal::compiler::Linkage*&, v8::internal::compiler::CodeTracer*&>(v8::internal::compiler::CallDescriptor*&, v8::internal::compiler::Linkage*&, v8::internal::compiler::CodeTracer*&) src/compiler/turboshaft/pipelines.h:88:27
#9 0x5ce6f0880fe6 in v8::internal::compiler::turboshaft::Pipeline::SelectInstructions(v8::internal::compiler::Linkage*) src/compiler/turboshaft/pipelines.h:312:48
#10 0x5ce6f0869beb in v8::internal::compiler::(anonymous namespace)::GenerateCodeFromTurboshaftGraph(v8::internal::compiler::Linkage*, v8::internal::compiler::turboshaft::Pipeline&, v8::internal::compiler::PipelineImpl*, std::__Cr::shared_ptr<v8::internal::compiler::OsrHelper>) src/compiler/pipeline.cc:504:28
#11 0x5ce6f08738dc in v8::internal::compiler::Pipeline::GenerateCodeForWasmNativeStubFromTurboshaft(v8::internal::wasm::CanonicalSig const*, v8::internal::wasm::WrapperCompilationInfo, char const*, v8::internal::AssemblerOptions const&, v8::internal::compiler::SourcePositionTable*) src/compiler/pipeline.cc:3061:26
#12 0x5ce6f19cb9ca in v8::internal::compiler::CompileWasmImportCallWrapper(v8::internal::wasm::ImportCallKind, v8::internal::wasm::CanonicalSig const*, bool, int, v8::internal::wasm::Suspend) src/compiler/wasm-compiler.cc:1729:17
#13 0x5ce6eff41362 in v8::internal::wasm::WasmImportWrapperCache::CompileWasmImportCallWrapper(v8::internal::Isolate*, v8::internal::wasm::ImportCallKind, v8::internal::wasm::CanonicalSig const*, v8::internal::wasm::CanonicalTypeIndex, bool, int, v8::internal::wasm::Suspend) src/wasm/wasm-import-wrapper-cache.cc:158:34
#14 0x5ce6efbc3ebe in __RT_impl_Runtime_TierUpWasmToJSWrapper src/runtime/runtime-wasm.cc:745:24
#15 0x5ce6efbc3ebe in v8::internal::Runtime_TierUpWasmToJSWrapper(int, unsigned long*, v8::internal::Isolate*) src/runtime/runtime-wasm.cc:627:1
#16 0x5ce6f1ba63c8 in Builtins_WasmCEntry setup-isolate-deserialize.cc
#17 0x5ce6f1b9d20b in Builtins_WasmToJsWrapperCSA setup-isolate-deserialize.cc
#18 0x7b788bed2996 (<unknown module>)
#19 0x5ce6f1b9c814 in Builtins_JSToWasmWrapperAsm setup-isolate-deserialize.cc
#20 0x5ce6f1c7e3fd in Builtins_JSToWasmWrapper setup-isolate-deserialize.cc
#21 0x5ce6f1afec74 in Builtins_InterpreterEntryTrampoline setup-isolate-deserialize.cc
#22 0x5ce6f1afc75b in Builtins_JSEntryTrampoline setup-isolate-deserialize.cc
#23 0x5ce6f1afc4aa in Builtins_JSEntry setup-isolate-deserialize.cc
#24 0x5ce6ee6c5f25 in v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) src/execution/execution.cc:437:22
#25 0x5ce6ee6c68c8 in v8::internal::Execution::CallScript(v8::internal::Isolate*, v8::internal::DirectHandle<v8::internal::JSFunction>, v8::internal::DirectHandle<v8::internal::Object>, v8::internal::DirectHandle<v8::internal::Object>) src/execution/execution.cc:537:10
#26 0x5ce6ee296fbc in v8::Script::Run(v8::Local<v8::Context>, v8::Local<v8::Data>) src/api/api.cc:2146:7
#27 0x5ce6ee210593 in v8::Shell::ExecuteString(v8::Isolate*, v8::Local<v8::String>, v8::Local<v8::String>, v8::Shell::ReportExceptions, v8::Global<v8::Value>*) src/d8/d8.cc:1018:44
#28 0x5ce6ee23129f in v8::SourceGroup::Execute(v8::Isolate*) src/d8/d8.cc:4979:10
#29 0x5ce6ee238db7 in v8::Shell::RunMainIsolate(v8::Isolate*, bool) src/d8/d8.cc:5930:37
#30 0x5ce6ee23884c in v8::Shell::RunMain(v8::Isolate*, bool) src/d8/d8.cc:5838:18
#31 0x5ce6ee23ad8d in v8::Shell::Main(int, char**) src/d8/d8.cc:6696:18
#32 0x7b788bc29d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
Address 0x79c88b272f34 is a wild pointer inside of access range of size 0x000000000004.
SUMMARY: AddressSanitizer: heap-buffer-overflow src/compile
The report classifies the crash type as Renderer. The ASan output shows a four-byte read at an address that is a wild pointer, inside a heap left redzone, confirming the out-of-bounds read in GetVirtualRegister.
Root cause
The wrapper builder sizes its argument vector from the imported function's expected arity, adding the fixed extras on top. When that arity is 0xfffa or more, the total argument node count exceeds the 0xfffe limit, and the node identifiers produced for the call no longer index validly into the instruction selector's virtual_registers_ vector. GetVirtualRegister then reads and, in the invalid-register case, writes outside the vector.
The report describes the result as immediate out-of-v8sbx memory corruption: an attacker can spray target data of virtual_registers_[id] == InstructionOperand::kInvalidVirtualRegister, which the vulnerability allows to be modified to a different value. The report adds that this is not the only problem: the bug will also likely result in a broken compilation result, which opens up other avenues of exploitation.
Impact
A renderer crash is the demonstrated outcome. Beyond that, the report frames the bug as memory corruption outside the V8 sandbox, with the out-of-bounds write reachable when the out-of-bounds slot contains the invalid virtual register sentinel, and with the broken compilation result as a likely further exploitation path. The report does not include a working full exploit; that was still to be determined at the time of writing.
Fix
The report does not describe a fix or the change that was made.
Variants to test
- Vary the arity boundary. Try imported JS functions with arities around
0xfffaand just below it, and check whether the wrapper compiles cleanly below the boundary and crashes at or above it. A positive result is an ASan heap-buffer-overflow inGetVirtualRegisteronly at and above the boundary. - Vary the import call kind. The dispatch handle adds one more argument when the kind is not
kUseCallBuiltin; test both kinds at the same arity and see whether the extra slot shifts the threshold. A positive result is a crash at a lower arity for the kind that includes the dispatch handle. - Exercise tier-up rather than first compilation. Call the imported function enough to trigger
Runtime_TierUpWasmToJSWrapperand confirm the crash appears on the tier-up path shown in the stack trace. A positive result is the sameInitializeCallBufferframe reached through__RT_impl_Runtime_TierUpWasmToJSWrapper. - Test the write branch. Arrange heap contents so the out-of-bounds slot reads as
InstructionOperand::kInvalidVirtualRegisterand check whether the subsequent store corrupts adjacent memory. A positive result is an ASan report on the write atvirtual_registers_[id] = virtual_registerrather than only the read. - Look for the broken compilation result. After a non-crashing out-of-bounds read, inspect whether the generated wrapper behaves incorrectly. A positive result is a wrapper that compiles but misbehaves at call time, which the report flags as a likely additional exploitation avenue.
What happened, in plain words
Chrome runs JavaScript and WebAssembly code using a piece of software called V8. WebAssembly (often shortened to Wasm) is a way to run code written in other languages, such as C or Rust, inside the browser at near-native speed. JavaScript is the language that web pages normally use. The two can call each other: a Wasm program can ask to use a JavaScript function that the page provides.
When that happens, V8 does not simply jump straight into the JavaScript function. It builds a small piece of machine code, called a wrapper, whose job is to take the arguments coming from the Wasm side, arrange them the way the JavaScript function expects, and then make the call. This wrapper is produced by V8's optimising compiler, Turboshaft. Later, V8 may decide to rebuild the wrapper in a slightly different form, a process called tier-up.
The wrapper has to set aside room for every argument it will pass along. How many arguments there are depends on the arity of the imported JavaScript function. Arity simply means the number of parameters a function declares. If a function is declared to take a very large number of parameters, the wrapper needs a very large list of arguments, and the compiler's internal record-keeping has to cope with that size.
This report describes what happens when that list gets too large. At an arity of 0xfffa (that is 65,530 in decimal) or more, the compiler's internal numbering of arguments overflows a limit of 0xfffe (65,534). The compiler then uses a number that no longer points at a valid entry in one of its internal tables, and it reads and possibly writes memory outside that table. This kind of mistake is called a heap buffer overflow: a program reaches past the end of a block of memory it was given, into memory that belongs to something else.
The bug is tracked as CVE-2025-0999. CVE stands for Common Vulnerabilities and Exposures, a public catalogue that gives each known security flaw a unique identifier so people can refer to it unambiguously. It was reported through the Chrome VRP, Chrome's Vulnerability Reward Program, which pays people for finding and reporting security bugs. The reporter was Seunghyun Lee (@0x10n) of CMU CyLab. The bug was rated high severity, disclosed on 18 February 2025, and earned a bounty of 11,000 USD.
Context
V8 is the JavaScript and WebAssembly engine used by Chrome. An engine is the part of the browser that reads code and turns it into something the computer can actually run. When WebAssembly code imports a JavaScript function, V8 does not call the JavaScript function directly. Instead it builds a small native stub, a Wasm-to-JS wrapper, that marshals the arguments and performs the call. Marshalling means taking values from one calling convention and rearranging them into the form the other side expects, much like a postal worker repacking a parcel so it fits the next courier's rules.
That wrapper is compiled by Turboshaft, V8's optimising compiler. A compiler is a program that translates code from one form into another, here from the compiler's internal representation into real machine instructions. The wrapper can later be tiered up through the runtime function Runtime_TierUpWasmToJSWrapper. Tier-up is a common idea in modern engines: start with something quick and simple, then, once a piece of code proves it is used a lot, spend more effort producing a faster version.
The wrapper has to reserve space for every argument it will pass. The number of arguments is driven by the arity the imported JavaScript function expects, so a large arity means a large argument list, and the compiler's internal bookkeeping has to cope with it. Bookkeeping here means the tables and counters the compiler keeps to remember which value lives where.
This report describes a heap buffer overflow in that path, tracked as CVE-2025-0999, in the V8 component of Google Chrome. It was reported through the Chrome VRP by Seunghyun Lee (@0x10n) of CMU CyLab, rated high severity, and disclosed on 18 February 2025 with a bounty of 11,000 USD.
Setup
The bug was tested on Chrome M131 through M133 (latest stable at the time) and on d8 ToT, on all operating systems. d8 is V8's own command-line shell: a small standalone program that runs JavaScript and WebAssembly without a browser, which makes testing much easier. ToT stands for tip of tree, meaning the very latest development version of the source code.
The crash was reproduced with an AddressSanitizer build of d8:
./d8-asan-sandbox-testing-linux-release-v8-component-98499/d8 ./wasmtojs-tierup-isel-crash.js
Line by line:
./d8-asan-sandbox-testing-linux-release-v8-component-98499/d8is the path to thed8program that was built with AddressSanitizer. AddressSanitizer, often shortened to ASan, is a tool added to a program at build time that watches every memory access and shouts loudly the moment the program reads or writes outside the memory it should. It is like fitting a building with sensors on every door and window so any attempt to climb through the wrong one is recorded../wasmtojs-tierup-isel-crash.jsis the JavaScript file being run. The name hints at what it does: it exercises the Wasm-to-JS wrapper tier-up path and the instruction selection stage, and it is expected to crash.
The reproduction case is a script attached to the report as wasmtojs-tierup-isel-crash.js, which crashes due to the out-of-bounds access. A small wrapper, wrapper.html, loads that script in Chrome to show the same reproducibility in the browser. The report notes that a full exploit was still to be determined, and the bisect section is marked TBD. A bisect is the process of narrowing down exactly which code change introduced a bug; TBD means to be determined, so that work had not been done yet.
Finding it
The bug was initially discovered by a v8sbx fuzzer. A fuzzer is a program that throws huge amounts of random or semi-random input at a target, hoping to make it misbehave. v8sbx refers to the V8 sandbox, an isolation layer inside V8 designed to contain the damage if part of the engine is compromised. On investigation it turned out not to be a v8sbx violation at all, but a full-blown memory corruption bug. Memory corruption means a program has modified or read memory it was never supposed to touch, which is the kind of flaw that can often be turned into running an attacker's code.
The trigger condition is an imported JavaScript function whose expected arity is 0xfffa or more, compiled as a Wasm-to-JS wrapper during tier-up. At that size the total number of argument nodes required goes over the limit of 0xfffe and above, and the compiler's node identifiers stop being valid for the structures that index them. A node here is one item in the compiler's internal graph of operations, and an identifier is the number used to refer to it.
Exploitation
Step 1: build the wrapper with an oversized argument list
In BuildWasmToJSWrapper in v8/src/wasm/wrappers.cc, the argument vector is sized from the expected arity:
// https://source.chromium.org/chromium/chromium/src/+/main:v8/src/wasm/wrappers.cc;drc=[redacted];l=556
void BuildWasmToJSWrapper(ImportCallKind kind, int expected_arity,
Suspend suspend) {
// ...
int pushed_count = std::max(expected_arity, wasm_count);
// 5 extra arguments: receiver, new target, arg count, dispatch handle and
// context.
bool has_dispatch_handle =
kind == ImportCallKind::kUseCallBuiltin
? false
: [redacted];
base::SmallVector<OpIndex, 16> args(pushed_count + 4 +
(has_dispatch_handle ? 1 : 0));
// ...
Line by line:
- The first line is a comment giving the exact location in the Chromium source code where this snippet lives, including a revision identifier so the reader can find the same version.
void BuildWasmToJSWrapper(ImportCallKind kind, int expected_arity, Suspend suspend)declares the function that builds the wrapper. It takes three inputs: the kind of import call, the expected arity (the number of arguments the JavaScript side expects), and whether the call can suspend.int pushed_count = std::max(expected_arity, wasm_count);works out how many arguments will actually be pushed. It takes the larger of the expected arity and the Wasm side's own count, so whichever side needs more room wins.- The comment explains that five extra arguments are involved: receiver, new target, arg count, dispatch handle and context. These are internal values the call machinery needs in addition to the user's arguments. A receiver is the object a method is called on; a new target is used when a function is invoked as a constructor; the arg count says how many arguments follow; the dispatch handle is an internal reference; and the context is the environment the function runs in.
bool has_dispatch_handle = kind == ImportCallKind::kUseCallBuiltin ? false : [redacted];decides whether the dispatch handle is present. If the call kind iskUseCallBuiltin, there is no dispatch handle; otherwise it depends on the[redacted]setting.base::SmallVector<OpIndex, 16> args(pushed_count + 4 + (has_dispatch_handle ? 1 : 0));creates the vector that will hold the argument nodes. A vector is a growable list.OpIndexis the type of each entry, an index referring to an operation in the compiler's graph. The16is a small inline capacity, meaning the first sixteen entries are stored inside the object itself rather than in separate memory. The size ispushed_countplus four fixed extras plus one more if there is a dispatch handle.
The vector holds pushed_count argument nodes plus four fixed extras (receiver, new target, arg count and context), plus one more for the dispatch handle when the import call kind includes one. With expected_arity at 0xfffa or above, the resulting count exceeds what the rest of the compiler expects.
Step 2: tier-up compilation reaches instruction selection
The crash happens when the wrapper is tiered up. The stack trace shows the path from the runtime entry point down to instruction selection:
A stack trace is the list of function calls that were in progress at the moment something went wrong, with the most recent call at the top (numbered #0) and the outermost caller at the bottom. Reading it from the bottom up tells the story of how the program got there. Line by line, from the bottom:
#14is the runtime entry pointRuntime_TierUpWasmToJSWrapper, the function V8 calls when it decides to rebuild a wrapper.#13is the wrapper cache asking to compile a new import call wrapper.#12is the compiler entry point for that wrapper.#11and#10are the pipeline stages that turn the compiler's internal graph into machine code.#9and#8are the instruction selection pipeline, the stage that chooses which machine instructions to use.#7is the instruction selection phase itself.#6starts selecting instructions,#5walks through a block of the graph,#4visits a single node, and#3visits a call node.#2isInitializeCallBuffer, which prepares the buffer describing the call and its arguments.#1isUseLocation, which asks where a particular value should be placed.#0isGetVirtualRegister, the function that actually crashes.
The failing call is InstructionSelectorT::InitializeCallBuffer(), reached from VisitCall while selecting instructions for the wrapper's call node.
Step 3: out-of-bounds access in GetVirtualRegister
The faulting function is GetVirtualRegister:
// https://source.chromium.org/chromium/chromium/src/+/main:v8/src/compiler/backend/instruction-selector.cc;drc=[redacted];l=522
template <typename Adapter>
int InstructionSelectorT<Adapter>::GetVirtualRegister(node_t node) {
DCHECK(this->valid(node));
size_t const id = this->id(node); // [!] invalid id returned
DCHECK_LT(id, virtual_registers_.size());
int virtual_register = virtual_registers_[id]; // [!] oob read
if (virtual_register == InstructionOperand::kInvalidVirtualRegister) {
virtual_register = sequence()->NextVirtualRegister();
virtual_registers_[id] = virtual_register; // [!] potential oob write, and broken registers tracking
}
return virtual_register;
}
Line by line:
- The first line is again a comment pointing at the exact source location.
template <typename Adapter>makes this a template, a kind of code that can be reused with different underlying types. TheAdapterhere lets the same logic serve more than one compiler representation.int InstructionSelectorT<Adapter>::GetVirtualRegister(node_t node)declares the function. It takes a node and returns an integer, the virtual register number. A virtual register is a compiler's pretend register: a numbered slot used while generating code, later mapped onto real machine registers or memory.DCHECK(this->valid(node));is a debug check that the node is valid.DCHECKchecks are only active in debug builds, so in a release build this line does nothing.size_t const id = this->id(node);fetches the node's identifier. The comment marks this as the source of the problem: an invalid id is returned.DCHECK_LT(id, virtual_registers_.size());is another debug-only check that the id is smaller than the size of thevirtual_registers_vector. Again, in a release build this check is compiled out, so nothing stops the bad id.int virtual_register = virtual_registers_[id];reads the entry at that id. The comment marks this as an out-of-bounds read: ifidis too large, this reaches past the end of the vector.if (virtual_register == InstructionOperand::kInvalidVirtualRegister) {checks whether the value read is the special sentinel meaning no register has been assigned yet. A sentinel is a special value used to mean nothing here.virtual_register = sequence()->NextVirtualRegister();allocates a fresh virtual register number.virtual_registers_[id] = virtual_register;writes that number back to the same slot. The comment marks this as a potential out-of-bounds write and as broken register tracking, because the write lands outside the vector and the compiler's record of which register belongs to which node becomes wrong.return virtual_register;hands the number back to the caller.
The node identifier returned by this->id(node) is invalid, so the index into virtual_registers_ falls outside the vector. The read at that index is out of bounds. If the value read happens to equal InstructionOperand::kInvalidVirtualRegister, the function writes a freshly allocated virtual register back to the same out-of-bounds slot, which is a potential out-of-bounds write and leaves the register tracking broken.
Step 4: observe the crash
Running the reproduction script under the ASan build produces:
=================================================================
==713021==ERROR: AddressSanitizer: heap-buffer-overflow on address 0x79c88b272f34 at pc 0x5ce6f04cfac5 bp 0x7ffdc4a3e4d0 sp 0x7ffdc4a3e4c8
READ of size 4 at 0x79c88b272f34 thread T0
#0 0x5ce6f04cfac4 in v8::internal::compiler::InstructionSelectorT::GetVirtualRegister(v8::internal::compiler::turboshaft::OpIndex) src/compiler/backend/instruction-selector.cc:543:26
#1 0x5ce6f04d46f7 in v8::internal::compiler::OperandGeneratorT::UseLocation(v8::internal::compiler::turboshaft::OpIndex, v8::internal::LinkageLocation) src/compiler/backend/instruction-selector-impl.h:262:53
#2 0x5ce6f04d396d in v8::internal::compiler::InstructionSelectorT::InitializeCallBuffer(v8::internal::compiler::turboshaft::OpIndex, v8::internal::compiler::CallBufferT*, v8::base::Flags<v8::internal::compiler::InstructionSelectorT::CallBufferFlag, int, int>, int) src/compiler/backend/instruction-selector.cc:1744:31
#3 0x5ce6f04dbdef in v8::internal::compiler::InstructionSelectorT::VisitCall(v8::internal::compiler::turboshaft::OpIndex, v8::internal::compiler::turboshaft::Block*) src/compiler/backend/instruction-selector.cc:2846:3
#4 0x5ce6f04d6374 in v8::internal::compiler::InstructionSelectorT::VisitNode(v8::internal::compiler::turboshaft::OpIndex) src/compiler/backend/instruction-selector.cc:5602:9
#5 0x5ce6f04cdd76 in v8::internal::compiler::InstructionSelectorT::VisitBlock(v8::internal::compiler::turboshaft::Block*) src/compiler/backend/instruction-selector.cc:2031:7
#6 0x5ce6f04cd366 in v8::internal::compiler::InstructionSelectorT::SelectInstructions() src/compiler/backend/instruction-selector.cc:157:5
#7 0x5ce6f0f76b99 in v8::internal::compiler::turboshaft::InstructionSelectionPhase::Run(v8::internal::compiler::turboshaft::PipelineData*, v8::internal::Zone*, v8::internal::compiler::CallDescriptor const*, v8::internal::compiler::Linkage*, v8::internal::CodeTracer*) src/compiler/turboshaft/instruction-selection-phase.cc:359:55
#8 0x5ce6f08eb1e1 in auto v8::internal::compiler::turboshaft::Pipeline::Run<v8::internal::compiler::turboshaft::InstructionSelectionPhase, v8::internal::compiler::CallDescriptor*&, v8::internal::compiler::Linkage*&, v8::internal::CodeTracer*&>(v8::internal::compiler::CallDescriptor*&, v8::internal::compiler::Linkage*&, v8::internal::CodeTracer*&) src/compiler/turboshaft/pipelines.h:88:27
#9 0x5ce6f0880fe6 in v8::internal::compiler::turboshaft::Pipeline::SelectInstructions(v8::internal::compiler::Linkage*) src/compiler/turboshaft/pipelines.h:312:48
#10 0x5ce6f0869beb in v8::internal::compiler::(anonymous namespace)::GenerateCodeFromTurboshaftGraph(v8::internal::compiler::Linkage*, v8::internal::compiler::turboshaft::Pipeline&, v8::internal::compiler::PipelineImpl*, std::__Cr::shared_ptr<v8::internal::compiler::OsrHelper>) src/compiler/pipeline.cc:504:28
#11 0x5ce6f08738dc in v8::internal::compiler::Pipeline::GenerateCodeForWasmNativeStubFromTurboshaft(v8::internal::wasm::CanonicalSig const*, v8::internal::wasm::WrapperCompilationInfo, char const*, v8::internal::AssemblerOptions const&, v8::internal::compiler::SourcePositionTable*) src/compiler/pipeline.cc:3061:26
#12 0x5ce6f19cb9ca in v8::internal::compiler::CompileWasmImportCallWrapper(v8::internal::wasm::ImportCallKind, v8::internal::wasm::CanonicalSig const*, bool, int, v8::internal::wasm::Suspend) src/compiler/wasm-compiler.cc:1729:17
#13 0x5ce6eff41362 in v8::internal::wasm::WasmImportWrapperCache::CompileWasmImportCallWrapper(v8::internal::Isolate*, v8::internal::wasm::ImportCallKind, v8::internal::wasm::CanonicalSig const*, v8::internal::wasm::CanonicalTypeIndex, bool, int, v8::internal::wasm::Suspend) src/wasm/wasm-import-wrapper-cache.cc:158:34
#14 0x5ce6efbc3ebe in __RT_impl_Runtime_TierUpWasmToJSWrapper src/runtime/runtime-wasm.cc:745:24
#15 0x5ce6efbc3ebe in v8::internal::Runtime_TierUpWasmToJSWrapper(int, unsigned long*, v8::internal::Isolate*) src/runtime/runtime-wasm.cc:627:1
#16 0x5ce6f1ba63c8 in Builtins_WasmCEntry setup-isolate-deserialize.cc
#17 0x5ce6f1b9d20b in Builtins_WasmToJsWrapperCSA setup-isolate-deserialize.cc
#18 0x7b788bed2996 (<unknown module>)
#19 0x5ce6f1b9c814 in Builtins_JSToWasmWrapperAsm setup-isolate-deserialize.cc
#20 0x5ce6f1c7e3fd in Builtins_JSToWasmWrapper setup-isolate-deserialize.cc
#21 0x5ce6f1afec74 in Builtins_InterpreterEntryTrampoline setup-isolate-deserialize.cc
#22 0x5ce6f1afc75b in Builtins_JSEntryTrampoline setup-isolate-deserialize.cc
#23 0x5ce6f1afc4aa in Builtins_JSEntry setup-isolate-deserialize.cc
#24 0x5ce6ee6c5f25 in v8::internal::(anonymous namespace)::Invoke(v8::internal::Isolate*, v8::internal::(anonymous namespace)::InvokeParams const&) src/execution/execution.cc:437:22
#25 0x5ce6ee6c68c8 in v8::internal::Execution::CallScript(v8::internal::Isolate*, v8::internal::DirectHandle<v8::internal::JSFunction>, v8::internal::DirectHandle<v8::internal::Object>, v8::internal::DirectHandle<v8::internal::Object>) src/execution/execution.cc:537:10
#26 0x5ce6ee296fbc in v8::Script::Run(v8::Local<v8::Context>, v8::Local<v8::Data>) src/api/api.cc:2146:7
#27 0x5ce6ee210593 in v8::Shell::ExecuteString(v8::Isolate*, v8::Local<v8::String>, v8::Local<v8::String>, v8::Shell::ReportExceptions, v8::Global<v8::Value>*) src/d8/d8.cc:1018:44
#28 0x5ce6ee23129f in v8::SourceGroup::Execute(v8::Isolate*) src/d8/d8.cc:4979:10
#29 0x5ce6ee238db7 in v8::Shell::RunMainIsolate(v8::Isolate*, bool) src/d8/d8.cc:5930:37
#30 0x5ce6ee23884c in v8::Shell::RunMain(v8::Isolate*, bool) src/d8/d8.cc:5838:18
#31 0x5ce6ee23ad8d in v8::Shell::Main(int, char**) src/d8/d8.cc:6696:18
#32 0x7b788bc29d8f in __libc_start_call_main csu/../sysdeps/nptl/libc_start_call_main.h:58:16
Address 0x79c88b272f34 is a wild pointer inside of access range of size 0x000000000004.
SUMMARY: AddressSanitizer: heap-buffer-overflow src/compiler/backend/instructio
Line by line, the important parts:
- The
ERROR: AddressSanitizer: heap-buffer-overflowline is ASan announcing the class of problem: a read or write past the end of a heap allocation. The heap is the pool of memory a program uses for things created while it runs. READ of size 4 at 0x79c88b272f34 thread T0says the program tried to read four bytes at that address, on the main thread. Four bytes is the size of a 32-bit integer, matching theintread fromvirtual_registers_.- The numbered frames
#0to#32are the stack trace, the same call chain as before but now with the full path from the outermost entry point down to the crash. Frames#0to#14match the earlier trace. Frames#15to#23are the built-in entry points that got the program into Wasm and then into the runtime call. Frames#24to#32are thed8shell starting up and running the script. Address 0x79c88b272f34 is a wild pointer inside of access range of size 0x000000000004.A wild pointer is an address that does not point at anything the program legitimately owns. ASan is saying the four-byte read landed on such an address.- The
SUMMARYline repeats the key facts: heap-buffer-overflow, the source file and line, and the function where it happened. - The
Shadow bytesblock is ASan's memory map. ASan keeps one shadow byte for every eight bytes of real memory, recording whether those bytes are safe to use. The valuefameans heap left redzone, a guard area placed around heap allocations to catch exactly this kind of overrun. The[fa]in brackets marks the byte covering the address that was accessed, showing the read landed in the redzone. - The
Shadow byte legendexplains what each possible shadow value means, from00(addressable, safe) throughfa(heap left redzone) tocb(right alloca redzone). ==713021==ABORTINGsays ASan stopped the program rather than letting it continue with corrupted memory.
The report classifies the crash type as Renderer. A renderer is the Chrome process that handles a single web page's content, kept separate from the rest of the browser for safety. The ASan output shows a four-byte read at an address that is a wild pointer, inside a heap left redzone, confirming the out-of-bounds read in GetVirtualRegister.
Root cause
The wrapper builder sizes its argument vector from the imported function's expected arity, adding the fixed extras on top. When that arity is 0xfffa or more, the total argument node count exceeds the 0xfffe limit, and the node identifiers produced for the call no longer index validly into the instruction selector's virtual_registers_ vector. GetVirtualRegister then reads and, in the invalid-register case, writes outside the vector.
The report describes the result as immediate out-of-v8sbx memory corruption: an attacker can spray target data of virtual_registers_[id] == InstructionOperand::kInvalidVirtualRegister, which the vulnerability allows to be modified to a different value. Spraying here means filling memory with chosen values so that, by luck or by design, the out-of-bounds slot lands on data the attacker controls. The report adds that this is not the only problem: the bug will also likely result in a broken compilation result, which opens up other avenues of exploitation.
Impact
A renderer crash is the demonstrated outcome. Beyond that, the report frames the bug as memory corruption outside the V8 sandbox, with the out-of-bounds write reachable when the out-of-bounds slot contains the invalid virtual register sentinel, and with the broken compilation result as a likely further exploitation path. The report does not include a working full exploit; that was still to be determined at the time of writing.
Fix
The report does not describe a fix or the change that was made.
Variants to test
- Vary the arity boundary. Try imported JavaScript functions with arities around
0xfffaand just below it, and check whether the wrapper compiles cleanly below the boundary and crashes at or above it. A positive result is an ASan heap-buffer-overflow inGetVirtualRegisteronly at and above the boundary. - Vary the import call kind. The dispatch handle adds one more argument when the kind is not
kUseCallBuiltin; test both kinds at the same arity and see whether the extra slot shifts the threshold. A positive result is a crash at a lower arity for the kind that includes the dispatch handle. - Exercise tier-up rather than first compilation. Call the imported function enough to trigger
Runtime_TierUpWasmToJSWrapperand confirm the crash appears on the tier-up path shown in the stack trace. A positive result is the sameInitializeCallBufferframe reached through__RT_impl_Runtime_TierUpWasmToJSWrapper. - Test the write branch. Arrange heap contents so the out-of-bounds slot reads as
InstructionOperand::kInvalidVirtualRegisterand check whether the subsequent store corrupts adjacent memory. A positive result is an ASan report on the write atvirtual_registers_[id] = virtual_registerrather than only the read. - Look for the broken compilation result. After a non-crashing out-of-bounds read, inspect whether the generated wrapper behaves incorrectly. A positive result is a wrapper that compiles but misbehaves at call time, which the report flags as a likely additional exploitation avenue.
Glossary
- AddressSanitizer (ASan): a tool built into a program that detects out-of-bounds and other invalid memory accesses at runtime.
- Arity: the number of parameters a function declares, that is, how many arguments it expects.
- Bisect: the process of narrowing down which code change introduced a bug.
- Bounty: a payment made to a researcher for reporting a security bug.
- Chrome VRP: Chrome's Vulnerability Reward Program, which pays for security reports.
- Compiler: a program that translates code from one form into another, here into machine instructions.
- CVE: Common Vulnerabilities and Exposures, a public catalogue giving each known flaw a unique identifier.
- d8: V8's standalone command-line shell for running JavaScript and WebAssembly without a browser.
- Dispatch handle: an internal reference passed along with a call in some import call kinds.
- Fuzzer: a program that feeds large amounts of random or semi-random input to a target to find crashes.
- Heap: the pool of memory a program uses for data created while it runs.
- Heap buffer overflow: reading or writing past the end of a block of heap memory.
- Instruction selection: the compiler stage that chooses which machine instructions implement the program's operations.
- Marshalling: rearranging values from one calling convention into the form another side expects.
- Memory corruption: a program reading or modifying memory it was never supposed to touch.
- Node: one item in the compiler's internal graph of operations.
- Out-of-bounds: outside the boundaries of a memory region the program was given.
- Redzone: a guard area of memory placed around an allocation so overruns can be detected.
- Renderer: the Chrome process that handles a single web page's content, isolated from the rest of the browser.
- Sentinel: a special value used to mean nothing here.
- Stack trace: the list of function calls in progress at the moment something went wrong.
- Tier-up: recompiling a piece of code with a more optimised version once it is used enough.
- ToT: tip of tree, the latest development version of the source code.
- Turboshaft: V8's optimising compiler.
- V8: the JavaScript and WebAssembly engine used by Chrome.
- v8sbx: the V8 sandbox, an isolation layer inside V8 designed to contain damage if part of the engine is compromised.
- Vector: a growable list of items in memory.
- Virtual register: a compiler's pretend register, a numbered slot used while generating code.
- Wasm (WebAssembly): a binary format for running code written in other languages inside the browser at near-native speed.
- Wasm-to-JS wrapper: a small native stub V8 builds to call a JavaScript function from WebAssembly code.
- Wild pointer: an address that does not point at anything the program legitimately owns.