Skip to content

← Actionable
Medium, CVSS 6.5amended

Happy DOM has cookie scope forgery: no DNS-label boundary on Domain= matching , attacker origin sets victim cookies

CVE-2026-118661GHSA-5fpq-26gf-qwcr

What to do

Vendor fix available. Upgrade each affected package to the fixed version on its release line (happy-dom 20.14.6), redeploy, then verify what is actually installed.

This page has no inventory attached, so it cannot say whether you are affected. A vendor fix is not proof that your deployment is fixed.

Affected packages

  • npm happy-dom

    Affected
    < 20.14.6
    Fixed in
    20.14.6

Sources

Severity and exploitation
Exploitation
No confirmed exploitation recorded. Patch Next marks exploitation only from CISA KEV.
CVSS
6.5 · CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N
EPSS
  • CVE-2026-118661: 0.27% estimated exploitation activity in the next 30 days; percentile 19.66 (FIRST EPSS, 2026-11-03). This is a model estimate, not proof of exploitation or customer exposure.
Source description

As published by the source; long descriptions are shortened.

Summary A cookie-scoping bug in happy-dom lets an attacker origin set cookies that a victim origin then receives, diverging from browser semantics.

Details happy-dom matches Domain=example.com against notexample.com (endsWith without a DNS-label boundary), diverging from browser semantics (verified 20.11.6 npm latest: cookieMatchesURL(Domain=example.com, url=http://notexample.com) = true). Relevant where happy-dom is used for SSR/prerender cookie handling. Matching in src/cookie/CookieContainer.ts.

PoC Run: ```bash node poc-happydom-cookie-domain.js ``` Full proof-of-concept source (poc-happydom-cookie-domain.js): ```js // PoC: happy-dom cookie-domain scoping gap -> cross-origin cookie injection / session fixation // Chain: app (window at http://localhost:PORT2) fetches attacker server (http://127.0.0.1:PORT1) // -> attacker Set-Cookie with Domain=localhost (a host that is NOT a suffix of 127.0.0.1) // -> happy-dom stores it (a real browser rejects: RFC 6265 §5.3.6-7 +…

Dates and revisions
Published by the source
Last modified by the source
Source last checked
  1. Revision 2 · amended ·

    Amended from osv record GHSA-5fpq-26gf-qwcr

  2. Revision 1 · created ·

    Published from ghsa record GHSA-5fpq-26gf-qwcr

Agent brief

Preview the exact text before you copy it. Commands are read-only suggestions; review them before running anything.

# Patch Next advisory brief: CVE-2026-118661

Advisory: Happy DOM has cookie scope forgery: no DNS-label boundary on Domain= matching , attacker origin sets victim cookies
IDs: CVE-2026-118661, GHSA-5fpq-26gf-qwcr
Record: https://patchnext.com/advisories/cve-2026-118661 (revision 2, source checked 29 Oct 2026, 06:00 UTC)
Inventory: none attached. This brief comes from a public page and does not say whether any deployment is affected.
Severity: Medium (CVSS 6.5)
Exploitation: no confirmed exploitation recorded. Patch Next confirms exploitation only from CISA KEV.
Vendor response: Vendor fix available; fixed versions by package: happy-dom 20.14.6. A vendor fix does not mean a deployment is fixed.

## Affected components
- npm happy-dom: affected < 20.14.6; fixed in 20.14.6

## Suggested inspection (read-only)
- `npm ls happy-dom --all`: lists every installed copy and version, including transitive ones. Run in the project root after `npm ci`.

## Supported action
Upgrade each affected component to a fixed version on its release line. For a transitive dependency, upgrade the parent package or add an override or constraint, then regenerate the lockfile. Redeploy every environment that ran an affected version.

## Required regression checks
- Run the test suite and a production build.
- Exercise the features that depend on happy-dom.
- Repeat the inspection and confirm that only fixed versions remain installed.

## Rollback considerations
- Keep the previous lockfile and deployment artifact. Rolling back reinstates the vulnerable version, so apply any documented mitigation while you fix forward.

## Unresolved questions
- Which deployments run an affected version?
- Exploitation status can change. Check again before lowering the priority.
- Mark the work resolved only after the fixed version is verified in production.

## Sources
- Verified: https://osv.dev/vulnerability/GHSA-5fpq-26gf-qwcr (OSV record GHSA-5fpq-26gf-qwcr lists affected ranges: npm happy-dom >=0 <20.14.6 (fixed))
- Verified: https://github.com/advisories/GHSA-5fpq-26gf-qwcr (GitHub-reviewed advisory GHSA-5fpq-26gf-qwcr lists affected ranges: npm happy-dom >=0 <=20.14.5)

Commands are suggestions: review each one before running it.

Loading voting…