CVE-2026-118661

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

Published Oct 28, 2026 CVSS 3.1 · 6.5 Medium EPSS < 1% KEV · Not listed
Description
Happy DOM is a JavaScript implementation of a web browser without its graphical user interface. Prior to 20.14.6, Happy DOM's CookieContainer in src/cookie/CookieContainer.ts does not correctly validate or match Domain cookie attributes. It can accept a Domain unrelated to the origin setting the cookie, including a public suffix, and separately treats an unrelated suffix-sharing hostname as a match because cookieMatchesURL does not enforce a DNS-label boundary. In server-side rendering and prerendering applications that contact attacker-controlled origins and then make requests to a victim origin, these behaviors can plant and deliver a forged cookie, enabling cookie injection or session fixation. This issue is fixed in version 20.14.6.

Analysis

AI-generated

Technical impact

Happy DOM’s CookieContainer does not properly validate or match Domain cookie attributes, allowing an attacker origin to set cookies that appear to belong to a victim origin. This cookie injection can lead to session fixation or unauthorized session hijacking. The flaw arises because Domain matching does not enforce a DNS‑label boundary, so a cookie set for a public suffix or a hostname that shares a suffix is treated as a match.

Affected Systems

The vulnerability affects all versions of Happy DOM prior to 20.14.6. The affected implementation is capricorn86:happy-dom, an open‑source JavaScript DOM that is used in server‑side rendering and prerendering applications.

Risk and Exploitability

With a CVSS score of 6.5, the risk is moderate to high. Although the EPSS score is low at 0.272%, the lack of Domain validation makes exploitation straightforward when an application accesses attacker‑controlled origins before establishing a user context. The vulnerability is not listed in the CISA KEV catalog, but any system that still uses an outdated Happy DOM version could be compromised through cookie injection or session fixation attacks.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade Happy DOM to version 20.14.6 or newer to apply the official fix.
  • If an application cannot immediately upgrade, consider replacing the old Happy DOM dependency with a shim that enforces DNS‑label boundaries on cookie domain checks or removing the dependency entirely.
  • Review server‑side rendering and prerendering pipelines to ensure no untrusted origins are accessed before user authentication, and configure cookies with SameSite or Secure attributes to limit accidental scope.

Generated by OpenCVE AI on October 30, 2026 at 14:46 UTC.

Tracking

Sign in to view the affected projects.

Advisories

Source ID Title
Github GHSA Github GHSA GHSA-5fpq-26gf-qwcr Happy DOM has cookie scope forgery: no DNS-label boundary on Domain= matching , attacker origin sets victim cookies
History
Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'yes', 'Exploitation': 'poc', 'Technical Impact': 'partial'}, 'version': '2.0.3'}

Type Values Removed Values Added
First Time appeared Capricorn86
Capricorn86 happy-dom
Vendors & Products Capricorn86
Capricorn86 happy-dom
Type Values Removed Values Added
Description Happy DOM is a JavaScript implementation of a web browser without its graphical user interface. Prior to 20.14.6, Happy DOM's CookieContainer in src/cookie/CookieContainer.ts does not correctly validate or match Domain cookie attributes. It can accept a Domain unrelated to the origin setting the cookie, including a public suffix, and separately treats an unrelated suffix-sharing hostname as a match because cookieMatchesURL does not enforce a DNS-label boundary. In server-side rendering and prerendering applications that contact attacker-controlled origins and then make requests to a victim origin, these behaviors can plant and deliver a forged cookie, enabling cookie injection or session fixation. This issue is fixed in version 20.14.6.
Title Happy DOM: Cookie scope forgery: no DNS-label boundary on Domain= matching , attacker origin sets victim cookies
Weaknesses CWE-565
References
Metrics cvssV3_1

{'score': 6.5, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N'}

Weaknesses
  • CWE-346

    Origin Validation Error

  • CWE-565

    Reliance on Cookies without Validation and Integrity Checking

Sources

Status
PUBLISHED
Assigner
GitHub_M
Published
Updated
Nov 3, 2026, 1:33 PM
Reserved
Oct 28, 2026, 5:25 PM
Status
Awaiting Analysis
Published
Oct 28, 2026, 9:16 PM
Modified
Nov 3, 2026, 2:17 PM
Severity
Moderate
Public date
Oct 28, 2026, 8:30 PM