
JavaScript is dynamically typed and V8 runs it at near-native speed. The trick
is speculation: V8 watches what your objects look like, bets that they will
keep looking that way, and generates specialised machine code. The bug in this
series is what happens when the bet is wrong in a way the engine did not
re-check.
The pipeline
A page's JavaScript goes through four stages:
- Parser — reads source, builds an abstract syntax tree.
- Ignition — compiles the AST to bytecode and runs it. This is the
baseline; it is correct and relatively slow. - Maglev — the mid-tier optimising compiler. It compiles hot functions to
machine code with moderate speculation, quickly. - Turbofan — the top-tier optimiser. It compiles the hottest functions
with aggressive speculation and heavy inlining.
Maglev and Turbofan are where the speed comes from, and where the assumptions
live. Both are in scope for CVE-2026-85046: the corpus names the flaw as the
Maglev and Turbofan inline implementation of Array.prototype.sort.
Shapes, maps and element kinds
V8 does not look up properties by name at runtime. It gives every object a
hidden map (a shape descriptor) and compiles property access as an offset
into that shape. Two objects with the same properties in the same order share
a map; adding a property creates a new map and invalidates the old assumption.
Arrays have an extra dimension: the element kind.
- PACKED_SMI_ELEMENTS — small integers, stored unboxed.
- PACKED_DOUBLE_ELEMENTS — floating point, stored unboxed.
- PACKED_ELEMENTS — arbitrary values, stored as tagged pointers.
- and the HOLEY_ variants, where the array has holes.
The element kind is part of the array's type. A fast path that reads a
PACKED_SMI array as raw 64-bit integers is making a bet about that kind. If
the kind changes and the code keeps reading the old way, a pointer is
interpreted as a number or a number as a pointer — which is exactly the
primitive a V8 exploit needs.
Inline caches and deoptimisation
An inline cache is a small bet at a call site: "the last time this ran, the
receiver had map M, so use offset O". If a different map arrives, the cache
misses, the engine takes the slow path, and may deoptimise the function
back to bytecode.
Deoptimisation is the safety net. The bug class in this series is a path where
the net does not catch the change — where the optimised code keeps using the
entry assumption after a callback has mutated the object underneath it.
Why sort is the hard case
Array.prototype.sort takes a user-supplied comparator, and the specification
allows that comparator to do anything — including mutating the array being
sorted. A correct inlined implementation therefore has to:
- check the element kind at entry;
- assume it only while nothing can invalidate it;
- re-check after every callback, because the comparator can add an object
to a SMI array, remove elements, or replace the array's contents entirely.
Step 3 is the one that is easy to get wrong, because the fast path is written
for the common case where the comparator is pure. The corpus's defect is
precisely an incomplete step 3.
The engine's own defence
V8 has hardening that makes exploitation harder even when a confusion exists:
pointer compression, the sandbox heap, external pointer tables, and the
renderer sandbox around the whole process. Those defences are why this CVE is
code execution inside the sandbox rather than an immediate host takeover.
They raise the cost of the second step; they do not remove the first.

Next: Part 6 — the small failures first: deopt, speculation and the
invalidation points that were missed before the big one.

Comments (0)