Buffer overflow in V8 (CVE-2026-78910)
The V8 WebAssembly deoptimisation path lacks stack limit checks, allowing a crafted Wasm function with a large Liftoff frame to move the stack pointer past a guard page on ARM64. An attacker could then write controlled data into adjacent memory before the process crashes.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 4 months
Project Fortify, an experimental security project, has identified the following potential security issue. If you're a feature owner CC-ed on this bug, please do your best to review these reports without the Chrome Security team. Please see https://chromium.googlesource.com/chromium/src/+/main/docs/security/ai-generated-security-bugs-faq.md for more information.
Overview: The V8 Wasm deoptimization path potentially lacks necessary compile-time and runtime stack limit checks for materialized Liftoff frames. On ARM64 platforms, this allows the stack pointer to skip over a JSPI stack guard page during large frame allocations. Subsequent frame copying writes attacker-controlled data into adjacent memory before crashing.
Affected files:
v8/src/deoptimizer/deoptimizer.ccv8/src/compiler/backend/code-generator.ccv8/src/builtins/arm64/builtins-arm64.cc
Estimated timestamp from git blame: 2024-05-27
Description
There is a potential out-of-bounds (OOB) write vulnerability in V8's WebAssembly deoptimization implementation. When a Wasm function deoptimizes, the engine materializes unoptimized (Liftoff) frames on the stack. The current logic fails to enforce stack limits during this process, allowing the stack pointer to bypass guard pages on ARM64 platforms (where page probing is not default for stack allocation).
This issue involves two missing safety checks in the V8 codebase:
- Compile-time Slack Offset Bypass:
In v8/src/compiler/backend/code-generator.cc, CodeGenerator::ShouldApplyOffsetToStackCheck determines if extra slack should be added to stack checks to account for potential deoptimization frames. However, the logic explicitly returns false if the kind is not kJSFunctionEntry:
if (kind != StackCheckKind::kJSFunctionEntry) return false;
Because Wasm uses StackCheckKind::kWasm, the Turbofan compiler does not reserve the necessary kStackLimitSlackForDeoptimizationInBytes for Wasm functions.
- Runtime Stack Limit Bypass:
In v8/src/deoptimizer/deoptimizer.cc, the Wasm-specific frame computation function Deoptimizer::DoComputeOutputFramesWasmImpl calculates the required space for output frames. Unlike the JavaScript equivalent (DoComputeOutputFrames), which strictly enforces limits with CHECK_GT(..., stack_guard->real_jslimit() - ...), the Wasm implementation completely omits this check. It blindly computes the frames assuming infinite stack space.
The ARM64 Write Primitive:
On ARM64, the deoptimization trampoline (Generate_DeoptimizationEntry in v8/src/builtins/arm64/builtins-arm64.cc) allocates space for output frames using the Claim macro. On non-Windows platforms, Claim merely performs a bulk subtraction on the stack pointer (sp).
If an attacker crafts a Wasm function with enough locals such that its Liftoff frame exceeds the OS page size (e.g., >4KB), the Claim operation moves sp directly across the stack's guard page and into the adjacent memory page below it.
The trampoline then calls CopyDoubleWords to populate the frame with the attacker's local variables. This performs an upward copy starting from the out-of-bounds sp. The attacker's data is written into the adjacent page until the copy loop hits the bottom of the guard page, which finally triggers a segmentation fault.
Potential Steps to Trigger
(Note: These are suggested steps based on static analysis. Our tooling agent does not currently have the ability to run code to produce a working proof-of-concept).
- Enable JSPI: The attacker uses JavaScript Promise Integration (JSPI) (currently available via Origin Trial) to execute Wasm on a secondary stack (
StackSegment). These stacks are bounded by a guard page. - Groom Memory: The attacker grooms the renderer heap/memory to place a sensitive data structure immediately below a target JSPI stack allocation.
- Craft Wasm Payload: The attacker creates a Wasm function with a large number of local variables to ensure its unoptimized Liftoff frame is larger than the 4KB guard page.
- Force Deep Execution: The attacker executes the optimized Wasm function recursively or deep within a call chain to push the stack pointer very close to the stack limit.
- Trigger Deopt: The attacker provides input that fails a speculative check in the optimized code, triggering
wasm_deopt. - Race Condition: As the deoptimizer writes attacker-controlled locals into the page below the stack guard, a concurrent Web Worker thread quickly reads or utilizes the corrupted memory before the deoptimizing thread inevitably crashes on the guard page.
Suggested Fix
- Enforce Runtime Stack Checks: Add a
CHECK_GT(or appropriate fatal bailout) inDeoptimizer::DoComputeOutputFramesWasmImplto ensure that the newly computedcaller_frame_top_ - total_output_frame_sizedoes not exceed the valid stack limits (stack_guard->real_jslimit()). - Correct Compile-Time Slack: Update
CodeGenerator::ShouldApplyOffsetToStackCheckto properly handleStackCheckKind::kWasmwhen Wasm deoptimization is enabled, ensuring stack limits are correctly respected during normal execution. - Defense in Depth (ARM64): Consider implementing page probing for the
MacroAssembler::Claimbulk stack allocations on ARM64 Linux/Android (similar to the Windows implementation), which would safely trap on the guard page beforespreaches out-of-bounds memory.
Evaluated with Chrome root at commit: eca8648a4e1cdfdda68c495a6003059fed641955
Results so far have been promising, but there can be wrong deductions. If this proves to be a false positive, please close as WAI; data from false positives will be used to improve accuracy over time. And please feel free to reach out to me directly if you have concerns or feedback on the project.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
How it worked
Root cause
Likely the Wasm deoptimisation code omits the stack limit checks that the JavaScript path enforces, and the compiler does not reserve extra stack slack for Wasm functions.
Impact
An attacker could write controlled data into memory adjacent to a JSPI stack on ARM64, potentially corrupting sensitive structures before the process crashes; the report notes the tooling could not produce a working proof-of-concept.
What the attacker needed
JSPI enabled (Origin Trial); ARM64 platform; Ability to run crafted Wasm; Concurrent Web Worker
The fix
The report suggests adding runtime stack limit checks in the Wasm deoptimiser, correcting the compile-time slack calculation for Wasm, and considering page probing for bulk stack allocations on ARM64.
How it was found
- Enable JavaScript Promise Integration (JSPI) to run Wasm on a secondary stack with a guard page.
- Groom memory to place a sensitive data structure below a target JSPI stack allocation.
- Create a Wasm function with many local variables so its Liftoff frame exceeds the 4KB guard page.
- Execute the optimized Wasm function deeply to push the stack pointer close to the limit.
- Provide input that fails a speculative check to trigger deoptimisation.
- Use a concurrent Web Worker to read the corrupted memory before the deoptimising thread crashes.
Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.
Not written yet. The AI write-up for this report has not been written yet. The Original tab links to the source.
When a program runs code, it uses a stack, a region of memory for temporary data. A guard page is a protected memory page that catches the program if it tries to use too much stack. This report says a bug in the V8 JavaScript engine could let a specially crafted WebAssembly function jump over that guard page and write data into nearby memory, which could corrupt other data before the program crashes.
What is Memory corruption?
Native code reads or writes memory it should not: overflows, use-after-free, type confusion. The core of browser, kernel and parser bugs.