The patch for CVE-2026-46625 adds one line to js-cookie's five-line assign helper: if (key === '__proto__') continue, inside the for (var key in source) loop the helper uses to merge cookie attributes. The CVE description ends with the sentence "Object.prototype itself is untouched." The commit message names the bug as "prototype pollution." The two statements are not in conflict; they describe the same write, observed from different sides of the merge target.
CVE-2026-46625: js-cookie's Merge Target Got a New Prototype. Object.prototype Was Untouched.
vendor
pattern
cve
proof of concept
target[key] = source[key] is not always a write
The vulnerable function in CVE-2026-46625 is assign in src/assign.mjs. The unpatched body, five lines including braces:
export default function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i]
for (var key in source) {
target[key] = source[key]
}
}
return target
}assign is called once per Cookies.set() invocation, from src/api.mjs:
attributes = assign({}, defaultAttributes, attributes)target is a fresh {}. defaultAttributes is the library's {path: '/'} constant. The third argument is whatever the caller passed for cookie attributes.
For a caller who builds the third argument with object-literal syntax, like Cookies.set('session', token, {expires: 7, secure: true}), the merge is uneventful. The for-loop iterates expires and secure. The writes are plain data assignments against target. The merged object is the union of own data properties.
For a caller who hands assign an object built by JSON.parse against untrusted input, the loop is governed by a property of the JavaScript language that the developer almost certainly did not have in mind when they wrote target[key] = source[key]. The bracket-assignment operator is not always a plain write. When the key is the string __proto__ and the target's prototype chain includes Object.prototype, the operator invokes a setter. The setter does not store the key. It replaces the target's prototype with the value.
JSON.parse keeps __proto__. Object literals do not.
Object-literal syntax treats __proto__ as a directive. The expression {__proto__: x} constructs an object whose [[Prototype]] is x; the result has no own property named __proto__ afterward. ECMA-262 specifies the behavior at the grammar level under PropertyDefinition. It is a feature of the object initializer, not a property write.
JSON has no concept of prototypes. The grammar accepts __proto__ as a string-quoted member name in an object value, no different from any other quoted name. JSON.parse materializes the result by walking the parse tree and writing each member as an own data property of the resulting object. The string __proto__ survives the walk:
> Object.getOwnPropertyNames({__proto__: {x: 1}})
[]
> Object.getOwnPropertyNames(JSON.parse('{"__proto__":{"x":1}}'))
[ '__proto__' ]The two parsers produce different objects from inputs the human eye reads as similar. A library that consumes the output of both, as js-cookie does the moment a caller passes a JSON-parsed configuration object, has to behave the same way under both. The for (var key in source) loop in assign enumerates the own enumerable properties of source plus its inherited enumerable ones. For a JSON-parsed source, the enumeration includes the string __proto__. For an object-literal source, it does not.
target.__proto__ = X is a setter call
target[key] = source[key] is not a write when key is __proto__. It is a setter call that replaces the target's prototype.
target is a fresh {}. Its prototype chain ends at Object.prototype. Object.prototype declares __proto__ as an accessor pair, with a getter that returns the object's [[Prototype]] and a setter that delegates to Object.setPrototypeOf against the receiver. Every plain object in the runtime inherits the accessor.
The expression target[key] = source[key], where key is the string "__proto__", runs through the language's [[Set]] semantics. [[Set]] walks the prototype chain looking for an existing accessor. It finds the __proto__ setter on Object.prototype and calls it. The setter does not store an own property named __proto__ on target. It calls Object.setPrototypeOf(target, source["__proto__"]). The merge target's prototype is replaced with whatever the attacker placed under __proto__ in the JSON string.
This is the sentence in the CVE-2026-46625 description that reads "Object.prototype itself is untouched." It is precisely accurate. No write occurred against any shared object. Object.prototype.foo is still undefined. ({}).foo on any freshly constructed object literal anywhere else in the process is still undefined. What changed is the prototype of one specific object: the merged attributes object that set is about to iterate.
The serializer walks the prototype back out
The next several lines of set build the Set-Cookie attribute string:
var stringifiedAttributes = ''
for (var attributeName in attributes) {
if (!attributes[attributeName]) {
continue
}
stringifiedAttributes += '; ' + attributeName
if (attributes[attributeName] === true) {
continue
}
stringifiedAttributes += '=' + attributes[attributeName].split(';')[0]
}for (var attributeName in attributes) enumerates own enumerable AND inherited enumerable properties of its target. attributes is the merged object. Its [[Prototype]] is now the attacker's object. Every enumerable key the attacker placed on that object is reachable through attributes by inheritance.
The loop body cannot tell the difference between an own property the developer wrote and an inherited property the attacker installed via the setter. It iterates both. It appends each as '; ' + attributeName + '=' + value. The Set-Cookie header carries both.
The two for-loops in the call path do the same thing in opposite directions. The first walks the prototype chain into the merge, picking up __proto__ as an own enumerable key from the JSON-parsed source. The second walks the prototype chain out of the merge, picking up the keys the attacker hung off the new prototype. The library iterates the prototype on the way in. It iterates the prototype on the way out. The setter in the middle does the trade.
What the attacker writes lands in the header
The payload shape the CVE-2026-46625 description sketches:
{"__proto__":{"domain":"evil.example.com","samesite":"None"}}Run through the unpatched library, with Cookies.set('c', 'v', JSON.parse(payload)):
> const merged = assign({}, {path: '/'}, JSON.parse(payload))
> Object.getOwnPropertyNames(merged)
[ 'path' ]
> Object.getOwnPropertyNames(Object.getPrototypeOf(merged))
[ 'domain', 'samesite' ]The serializer iterates path, domain, samesite. Each value is non-empty. Each gets appended.
Set-Cookie: c=v; path=/; domain=evil.example.com; samesite=NoneThe browser receives the wire format and stores the cookie with the attributes the wire format declares. Browser cookie storage cannot distinguish the application's intended attributes from the attacker's inherited ones; both arrived in the same string from the same origin.
The CVE description names five attributes the attacker can choose: domain, secure, samesite, expires, path. The choice set is whatever the browser's cookie attribute grammar accepts as a key-value pair. domain= widens the cookie's reach to any parent or sibling domain the attacker can read. samesite=None removes a CSRF mitigation the application explicitly opted into. expires=Thu, 01 Jan 1970 00:00:00 GMT clobbers the cookie out of existence at the browser. Each is a string under an attacker-chosen key in JSON. Each is a Set-Cookie attribute on the wire.
The patch had to fit inside the loop
The fix for CVE-2026-46625, commit eb3c40e, merged on 15 May 2026:
for (var key in source) {
+ if (key === '__proto__') continue
target[key] = source[key]
}The diff blocks the exact key the setter cares about. It does not block constructor. It does not block prototype. It does not change target = {} to Object.create(null). It does not replace the for...in with Object.keys(source).forEach. The commit message explains why:
Note that at the moment we're tied to using this kind of for-loop for compatibility with IE 10 + 11.
Internet Explorer 10 stopped receiving security updates from Microsoft in January 2016. Internet Explorer 11's desktop client was retired on 15 June 2022. The commit landed on 15 May 2026, four years after Microsoft pulled the browser the loop is shaped around. js-cookie served 26.5 million weekly downloads from the npm registry in the week before this post. In 2026, the merge helper in a library at that fan-out is shaped at the line level by a browser whose last release shipped in 2013.
The constraint pins the patch to the only place it could live without breaking IE 11. Object.create(null) is supported in IE 9. Object.entries is not. for...in is. The maintainer chose the smallest change consistent with the compatibility matrix. The smallest change is a one-key blocklist against the one key the disclosed payload sends. The previous commit to touch src/assign.mjs, 0f293a6, dated 12 December 2019, is titled "Turn extend() into assign()," and its commit body reads: "The assign method is supposed to behave similar to Object.assign() (which we can't use due to IE support)." Six and a half years between the two commits. The IE constraint outlived IE.
constructor is also an own enumerable property after JSON.parse('{"constructor":{"domain":"x"}}'). The assignment target.constructor = X does not invoke a setter (constructor on Object.prototype is a plain data property, not an accessor), so the merge target's prototype is unchanged. But it does install a new own property constructor on target, which the downstream for-loop will then enumerate and serialize as ; constructor=[object Object]. Browsers ignore the unknown attribute. The hazard is narrower than __proto__'s. The merge helper still does not know which keys carry special meaning, in JavaScript or in the cookie attribute grammar.
This is Object Literal As Map, from the write side
This blog has a name for {} as a string-keyed container under attacker-controlled keys: Object Literal As Map. The canonical exhibits read from the container. multiparty's fields[name] || (fields[name] = []) in CVE-2026-8161 is a property read that walks the prototype chain into a crash. form-data-objectizer's if (inputName in result) in CVE-2026-46510 is a membership check that walks the prototype chain into a recursive write back into Object.prototype itself.
js-cookie's target[key] = source[key] is the same pattern from the write side. The container is {}. The keys are attacker-controlled. The write at __proto__ invokes a setter that replaces the container's prototype. The downstream consumer's for-loop walks the prototype the setter installed and serializes its keys onto the wire. The leak runs between iteration and inheritance, in both directions of the merge.
The three CVEs cluster around the same root cause and reach for the same three escapes: Object.create(null) for the container, hasOwnProperty.call for the membership read, an explicit blocklist for the key. multiparty chose the read gate. form-data-objectizer chose the read gate. js-cookie chose the blocklist. The container is {} in all three patched releases. The merge helper, the parser, and the result jar continue to ship the prototype chain to user code as if it were data.
PoC: GHSA-qjx8-664m-686j
Object.prototype was untouched. The cookie's domain still moved.