Advisory Database
  • Advisories
  • Dependency Scanning
  1. npm
  2. ›
  3. js-cookie
  4. ›
  5. CVE-2026-46625

CVE-2026-46625: JavaScript Cookie: Per-instance prototype hijack in assign() enables cookie-attribute injection

May 21, 2026 (updated June 11, 2026)

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.

References

  • github.com/advisories/GHSA-qjx8-664m-686j
  • github.com/js-cookie/js-cookie/commit/eb3c40e89731e99b8970faaf35ddad249c6c0020
  • github.com/js-cookie/js-cookie/releases/tag/v3.0.7
  • github.com/js-cookie/js-cookie/security/advisories/GHSA-qjx8-664m-686j
  • nvd.nist.gov/vuln/detail/CVE-2026-46625

Code Behaviors & Features

Detect and mitigate CVE-2026-46625 with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →

Affected versions

All versions before 3.0.7

Fixed versions

  • 3.0.7

Solution

Upgrade to version 3.0.7 or above.

Impact 7.5 HIGH

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N

Learn more about CVSS

Weakness

  • CWE-1321: Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution')

Source file

npm/js-cookie/CVE-2026-46625.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Tue, 23 Jun 2026 12:24:00 +0000.