Out of bounds read and write in V8 (CVE-2026-5873)
The V8 ARM64 backend folded a zero-extension of a 32-bit WebAssembly memory index into a 64-bit left-shift addressing mode, so the uncleared upper 32 bits of the register were included in the address calculation. An attacker could pass a large 64-bit value, truncate it to 32 bits and use it as an index to bypass the Wasm memory cage and V8 Sandbox, gaining arbitrary read/write and renderer RCE.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 14 days
Flapjack (go/flapjack), an LLM-powered vulnerability discovery tool, has identified a security issue and generated a PoC.
d8 variant: 'AsanArm64'
flags: --no-liftoff --no-wasm-lazy-compilation --omit-quit --fuzzing --disallow-unsafe-flags
Overview: The V8 ARM64 backend incorrectly optimizes 32-bit shifted memory accesses by peeling zero-extension nodes and using a 64-bit left shift addressing mode. Because 32-bit truncations do not clear the upper bits of a register on ARM64, attacker-controlled high bits are included in the address calculation. This allows an attacker to bypass the Wasm memory cage and V8 Sandbox, achieving arbitrary read/write and renderer RCE.
Affected files:
v8/src/compiler/backend/arm64/code-generator-arm64.ccv8/src/compiler/backend/arm64/instruction-selector-arm64.cc
Estimated timestamp from git blame: 2024-03-26
Root Cause
In the ARM64 Turbofan/Turboshaft backend, TruncateInt64ToInt32 is implemented as an identity operation; it reuses the virtual register without emitting code to clear the upper 32 bits. Therefore, the upper 32 bits of the 64-bit physical register remain "dirty" and attacker-controlled.
When calculating WebAssembly memory accesses, a 32-bit index is typically zero-extended to 64 bits via ChangeUint32ToUint64 before being added to the memory base pointer. However, in v8/src/compiler/backend/arm64/instruction-selector-arm64.cc, the function TryMatchLoadStoreShift explicitly peels off this ChangeUint32ToUint64 node to fold the underlying shift into the load/store instruction. It then sets the addressing mode to kMode_Operand2_R_LSL_I.
The bug is in how the code generator translates this mode. In v8/src/compiler/backend/arm64/code-generator-arm64.cc, Arm64OperandConverter::MemoryOperand implements kMode_Operand2_R_LSL_I by returning a MemOperand using an LSL shift on the full 64-bit X register:
return MemOperand(InputRegister(index + 0), InputRegister(index + 1), LSL, InputInt32(index + 2));
Because LSL does not zero-extend the index (unlike the UXTW extension mode), the dirty upper 32 bits of the register are shifted and added to the base address.
Impact
An attacker can trigger this by passing a large 64-bit value to a WebAssembly function, truncating it to 32 bits (e.g., i32.wrap_i64), and using it as a memory access index. The upper 32 bits will not be cleared, resulting in a massive 64-bit offset calculation. This bypasses the 8GB WebAssembly guard regions and the V8 Sandbox boundaries, granting arbitrary read/write access within the renderer process, which leads directly to Remote Code Execution (RCE).
Suggested Fix
The ARM64 backend must explicitly zero-extend the 32-bit index during the memory address calculation rather than relying on a 64-bit LSL.
- Introduce a new addressing mode specifically for zero-extended shifted indices (e.g.,
kMode_Operand2_R_UXTW_I) inTARGET_ADDRESSING_MODE_LIST. - In
TryMatchLoadStoreShift, if aChangeUint32ToUint64node is peeled, emit the newkMode_Operand2_R_UXTW_Imode instead ofkMode_Operand2_R_LSL_I. - In
Arm64OperandConverter::MemoryOperand, handle the new mode by constructing aMemOperandthat utilizes theUXTWextension (which correctly zero-extends the lower 32 bits before shifting):MemOperand(base, index, UXTW, shift_amount).
Evaluated with Chrome root at commit: a3f5fcb392f2902650ca2b71820e7e418787e18b
The description of the vuln is LLM-generated and can contain mistakes. Your feedback is appreciated, and will help us improve Flapjack over time. The PoC was run in a VM and it seemed to be legit - if not, let us know and we can strengthen our checker.
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
The ARM64 instruction selector peeled a ChangeUint32ToUint64 node and used a 64-bit LSL addressing mode, but TruncateInt64ToInt32 is an identity on ARM64, so the dirty upper 32 bits were shifted into the address instead of being zero-extended.
Impact
The oversized offset bypasses the 8GB Wasm guard regions and the V8 Sandbox, giving arbitrary read/write in the renderer and leading to RCE; the text notes the PoC was run in a VM and seemed legitimate.
What the attacker needed
Ability to run crafted Wasm in V8; ARM64 build of V8/d8
The fix
The ARM64 backend should add a dedicated zero-extending shifted addressing mode and use UXTW instead of LSL when a ChangeUint32ToUint64 node is peeled.
How it was found
- Pass a large 64-bit value into a WebAssembly function.
- Truncate it to 32 bits, for example with i32.wrap_i64.
- Use the truncated value as a memory access index so the upper bits survive into the address calculation.
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 uses a number as an offset into memory, it must make sure the number is the right size before adding it to a base address. On ARM64 chips, shortening a 64-bit number to 32 bits does not automatically wipe the leftover high bits, so if the code forgets to clear them, a huge offset can be produced. Here that let a crafted WebAssembly index reach memory outside the intended sandbox.
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.