Type Confusion in V8 (CVE-2026-5871)
A type confusion bug in V8's Maglev compiler caused a value to be treated as a Smi when it was actually a HeapNumber, leading to incorrect type assumptions. An attacker could potentially exploit this to cause memory corruption or other undefined behaviour.
Google Chrome
Originally disclosed on Chrome VRP
- Fix shipped in 15 days
Splitting from https://issues.chromium.org/u/1/issues/495149864#comment17 because this might be a separate bug.
Repro:
let o = { x : "abc" };
o.x = []; // Making non-string, non-const, but still HeapObject
function foo(c1, c2) {
let phi1 = c1 ? 42 : 0x40000000;
phi1 + 1; // inserting smi check
let phi2 = c2 ? true : phi1;
o.x = phi2;
}
%PrepareFunctionForOptimization(foo);
foo(true, true);
foo(true, true);
%OptimizeMaglevOnNextCall(foo);
foo(true, true);
foo(true, true);
foo(false, false);
with flags --allow-natives-syntax --maglev-untagged-phis --maglev-assert-types
Failure:
CheckMaglevType failed
DebugPrint: 0xf9e0104b685: [HeapNumber]
- map: 0x0f9e00000515 <Map[12](HEAP_NUMBER_TYPE)>
- value: 1073741824.0
0xf9e00000515: [Map] in ReadOnlySpace
- map: 0x0f9e00000475 <MetaMap (0x0f9e0000002d <null>)>
- type: HEAP_NUMBER_TYPE
- instance size: 12
- elements kind: HOLEY_ELEMENTS
- enum length: invalid
- stable_map
- non-extensible
- back pointer: 0x0f9e00000011 <undefined>
- prototype_validity_cell: 0
- instance descriptors (own) #0: 0x0f9e0000080d <DescriptorArray[0]>
- prototype: 0x0f9e0000002d <null>
- constructor: 0x0f9e0000002d <null>
- dependent code: 0x0f9e000007f5 <Other heap object (WEAK_ARRAY_LIST_TYPE)>
- construction counter: 0
Expected type: : DebugPrint: Smi: 0x10 (16)
Actual type: : DebugPrint: Smi: 0x2 (2)
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 Maglev compiler's untagged phi optimisation incorrectly assumed a value would always be a Smi, failing to account for a HeapNumber being assigned.
What the attacker needed
V8 with Maglev and untagged phis enabled; Ability to run JavaScript with native syntax
How it was found
- Create an object with a property initially set to a string, then change it to an array.
- Define a function that uses a conditional to assign either a Smi or a HeapNumber to a variable, then assigns that variable to the object property.
- Prepare the function for optimisation and call it multiple times with true arguments.
- Optimise the function with Maglev and call it again with true arguments.
- Call the function with false arguments to trigger the type confusion.
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 is a bug in the JavaScript engine V8, which compiles code to run faster. The compiler made a wrong guess about the type of a variable, treating a decimal number as a whole number, which can lead to crashes or security problems.
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.