
Before a type confusion becomes a CVE, it is a series of small failures: a
map that changed, a cache that missed, a deopt that did not happen. This part
walks the failure ladder — the ordinary ways a JIT gets assumptions wrong —
because the fundamental flaw is one rung above them.
Failure one: the map changes
The simplest JIT failure is a shape change. A function is optimised for an
object with fields {host, port}; the page then adds {host, port, user}, and
the object gets a new map. The inline cache misses, the engine deoptimises, and
the slow path handles it. This is normal and safe — the cost is performance,
not correctness.
The lesson: the engine knows how to lose a bet. The bug is never "the map
changed". It is "the code did not notice that the map changed".
Failure two: the element kind changes
Arrays are worse than objects because the element kind is part of the array's
storage. A PACKED_SMI array stores raw integers; a PACKED_ELEMENTS array stores
tagged pointers. If code specialised for SMI reads a tagged pointer as an
integer, it gets a plausible-looking number that is actually an address. If it
reads an integer as a tagged pointer, it gets a fake object.
Element-kind transitions are supposed to be tracked at every store. The
difficult cases are the ones where a callback does the store, because the
optimised code may not be the code doing the mutation.
Failure three: the callback is hostile
This is the rung the CVE sits on. Array.prototype.sort is not a pure
function over an array; it is a loop that calls user code between
comparisons. Between two iterations, the comparator can:
- change an element's type (SMI → object, object → SMI);
- truncate or extend the array;
- replace the array's backing store;
- throw, or call back into the engine recursively.
A correct inlined sort re-reads the element kind after every callback and
falls back to the generic path if anything changed. An inlined sort that keeps
using the entry assumption is fast, and wrong.
Failure four: the optimiser believes its own feedback
Type feedback is collected during interpretation: "this call site has seen
SMI arrays 1,000 times". Maglev and Turbofan use that feedback to specialise.
The feedback is a statistically reasonable bet, and the engine has invalidation
machinery to revoke the bet when the world changes.
The system is sound only if every invalidation point is wired to the
specialised code. Missing one is not a design flaw in the JIT; it is a bug in
one builtin — but the consequence is a type confusion, because the code keeps
reading memory according to a type that is no longer true.
Failure five: the confusion becomes a primitive
Once two types are treated as one, exploitation is a matter of construction:
- addrof — place an object where the engine expects a number; read the
raw value; now you have the object's address as a JS number. - fakeobj — place a crafted number where the engine expects an object
pointer; now you have a JS object at an address you chose.
Those two primitives are the foundation of a V8 exploit. From there: a
crafted object with controlled length and elements pointer gives arbitrary
read/write inside the renderer; from there, code execution in the sandbox.
The pattern to remember
JIT bugs are not exotic. They are the ordinary consequence of optimising a
language whose types are dynamic and whose callbacks are hostile. The engine
loses bets all day and recovers. What makes a CVE is a bet that the engine
does not know it lost.

Next: Part 7 — the first and most fundamental flaw: CVE-2026-85046, the
missing re-check, and the exact sentence the advisory used.

Comments (0)