
Root-cause analysis and PoC for CVE-2026-109715, an unguarded CacheIR SetGName stub in Firefox's SpiderMonkey JIT enabling a cross-object slot-confused Value write from JavaScript.
SpiderMonkey's property-store IC generator has a fast path for one very specific case: an unqualified assignment to a global lexical binding, the let/const kind that lives in the global lexical environment rather than on the global object. For that case the generator emits a store-slot stub with no guards at all, and it documents why in a comment sitting right on top of the code:
// There is no need to guard on the shape. Global lexical bindings are
// non-configurable and can not be shadowed.
Both halves of that are true. Global lexical bindings really are non-configurable and unshadowable, so the shape of the environment never changes out from under the stub. The problem is that the comment reasons about shape while the stub it justifies consumes identity. The stub stores through whatever object the executing bytecode pushed, at a slot offset taken from the object the stub was trained on. When those are two different objects, the store lands at an offset that belongs to somebody else's layout: a full tagged Value, written into a slot of the wrong object.
You can make them two different objects from plain JS. That is the CVE.
SetPropIRGenerator::tryAttachNativeSetSlot (js/src/jit/CacheIR.cpp), Firefox 155:
static bool IsGlobalLexicalSetGName(JSOp op, NativeObject* obj,
PropertyInfo prop) { ... }
NativeObject* nobj = &obj->as<NativeObject>();
if (!IsGlobalLexicalSetGName(JSOp(*pc_), nobj, *prop)) {
// shape guard for the normal case
TestMatchingNativeReceiver(writer, nobj, objId);
} // lexical case: NO GUARD
EmitStoreSlotAndReturn(writer, objId, nobj, *prop, rhsId);
Every case gets a shape guard except the lexical one, which gets the comment instead.
Look at the last line with two names in it. nobj is the training object: the environment the stub was attached against, whose layout supplies the slot offset. objId is the IC operand: whatever environment object the executing bytecode happens to push when the SetGName runs. The stub stores through objId at nobj's offset. The shape guard that the lexical case skips was the only thing connecting the two, and shape was never the right property to check anyway. What needed guarding was identity, and nothing did.
Firefox 158 asks the missing question in one line:
if (IsGlobalLexicalSetGName(JSOp(*pc_), nobj, *prop)) {
writer.guardSpecificObject(objId, nobj); // guard the env's identity
} else { ... }
An unqualified assignment name = rhs compiles to BindGName name; <rhs>; SetGName name. The environment is resolved and pushed onto the stack before the RHS runs. That ordering is the entire attack.
If the RHS creates a new global lexical binding of the same name, and then re-trains the very IC site whose store is still pending, the pending store wakes up holding a different environment than the one the stub was trained on:
function assign(mode) {
if (mode) {
newBinding = mode === 1 ? confuse() : "value for global lexical";
}
}
function confuse() {
evaluate("let newBinding;"); // create the lexical binding NOW:
// assign(1)'s env (global OBJECT) is
// already on its stack
for (let i = 0; i < 3; i++) {
assign(2); // train the IC: unguarded stub
}
}
assign(1) resolves newBinding while the name is still a plain global reference, so the global object goes on the stack. Then confuse() runs: evaluate("let newBinding;") creates the lexical binding under the pending store's feet, and the three assign(2) calls train the SetGName IC site against the lexical environment, attaching the unguarded stub. When confuse() returns and assign(1)'s store finally executes, its operand is the global object and its stub is the lexical one. StoreSlot(globalObject, slotN).
155.0 release shell, no flags, 3/3:
BINDING CONFUSION (vulnerable):
globalThis.newBinding = undefined (expected 'valueForGlobalThis')
lexical newBinding = value for global lexical
Per spec, the store had to define the plain global-object property newBinding, because the reference was resolved before the lexical binding existed. The property is never created. Instead the write went through the stub into slot N of the global object, and whatever the global's layout keeps at the lexical binding's offset, another binding's slot or a reserved slot, received the attacker-controlled Value. The value you can read from JS went to the right place. The value you cannot see went somewhere else entirely.
This is more than a confused variable. It is a wrong-object, wrong-offset Value write:
let/const declared before training. The attacker picks N by declaring bindings.Point N at a reserved slot of the global, or at any slot whose expected Value shape differs from the one written, and this stops being a curiosity: a tagged word lands in engine internals that were expecting something else. A type confusion with attacker-chosen offset and contents, from plain JS, no flags.
$ js poc.js # vulnerable: BINDING CONFUSION, rc=1
$ 158/js poc.js # fixed: bindings correct