High · 8.6 Node.js & npm GHSA-5fpq-26gf-qwcr CVE-2026-118661 GHSA-c8p4-j97h-3vg8 CVE-2026-118660
Happy DOM: Cookie Scope Forgery and SSRF Vulnerabilities Fixed in Recent Releases
Two vulnerabilities in the Happy DOM npm package allow cookie scope forgery (CVE-2026-118661) and server-side request forgery via iframe/stylesheet loading (CVE-2026-118660). Both are fixed in later releases.
By PatchBriefing · ·
Produced automatically from official sources with the help of AI. How we work →
AI summary
Happy DOM, a JavaScript implementation of a web browser used in server-side rendering and testing environments, was affected by two distinct vulnerabilities disclosed around the same time. The first involves improper validation of cookie domain attributes, allowing cookie scope forgery. The second is a server-side request forgery (SSRF) issue caused by default behavior that loads iframe and stylesheet URLs while parsing untrusted HTML. Both issues have been addressed by the maintainers in subsequent releases.
What happened
Two vulnerabilities were identified in Happy DOM, a JavaScript library that emulates a web browser DOM without a graphical interface, commonly used for server-side rendering (SSR) and prerendering. The first vulnerability (CVE-2026-118661) affects the CookieContainer component, which did not correctly validate or match the Domain attribute of cookies. The implementation could accept a Domain value unrelated to the origin that set the cookie, including public suffixes, and separately failed to enforce a DNS-label boundary when matching hostnames, allowing unrelated suffix-sharing hostnames to be treated as matches. The second vulnerability (CVE-2026-118660) is a server-side request forgery (SSRF) issue. By default, Happy DOM loaded iframe 'src' URLs and link 'rel="stylesheet"' 'href' URLs while parsing HTML, because the options to disable this behavior (disableIframePageLoading and disableCSSFileLoading) defaulted to false.
Technical cause
For CVE-2026-118661, the root cause lies in the CookieContainer logic (src/cookie/CookieContainer.ts), which lacked proper boundary checks when matching cookie Domain attributes against request URLs via cookieMatchesURL. This allowed cookies to be set and matched across unrelated domains, including domains that merely share a suffix with the legitimate origin. For CVE-2026-118660, the root cause is a default configuration choice: Happy DOM's HTML parser automatically resolves and loads external resources referenced in iframe and stylesheet link tags, without requiring applications to explicitly opt in to this network behavior.
Why it matters
In server-side rendering or prerendering applications that process HTML from attacker-controlled origins and subsequently make requests to a victim origin, the cookie validation flaw (CVE-2026-118661) can allow an attacker to plant and deliver forged cookies, potentially leading to cookie injection or session fixation. The SSRF vulnerability (CVE-2026-118660) is more severe in terms of potential impact: an attacker who controls HTML parsed by Happy DOM on the server can force the server to make outbound requests to arbitrary internal or cloud endpoints. This could expose confidential responses or credentials returned by those internal services, without the application explicitly opting into such network access.
Who is affected
Applications and services using the happy-dom npm package, particularly those that perform server-side rendering or prerendering of HTML that may originate from or include content from untrusted or attacker-controlled sources, are affected by these vulnerabilities.
Affected versions
For CVE-2026-118661 (cookie scope forgery), versions of happy-dom up to and including 20.14.5 are affected. The issue is fixed in version 20.14.6. For CVE-2026-118660 (SSRF via iframe/stylesheet loading), versions of happy-dom up to and including 20.14.6 are affected. The issue is fixed in version 21.0.0.
Fixes and mitigation
The cookie scope forgery issue (CVE-2026-118661) has been resolved in happy-dom version 20.14.6. The SSRF issue (CVE-2026-118660) has been resolved in happy-dom version 21.0.0, which notably postdates the fix for the cookie issue. Applications should update to version 21.0.0 or later to address both vulnerabilities.
Recommended action
Update happy-dom to version 21.0.0 or later, which contains fixes for both vulnerabilities described in this briefing. Teams using happy-dom for server-side rendering or prerendering of HTML from untrusted sources should prioritize this update, given the SSRF vulnerability's potential to expose internal network resources.
PatchBriefing score
8.6 / 10 · High
Official CVSS: 8.6
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:N/A:N
EPSS 0.0052 (38 percentile)
Why this score
The PatchBriefing score equals the official CVSS score; when this article covers several vulnerabilities, the highest one. Signals such as known exploitation and EPSS are listed separately and do not change the score.
Affected versions
- happy-dom <= 20.14.5
- vulnerable
- happy-dom ≥ 0 < 20.14.6
- vulnerable
- ≥ 20.14.6
- patched
- happy-dom <= 20.14.6
- vulnerable
- happy-dom ≥ 0 < 21.0.0
- vulnerable
- ≥ 21.0.0
- patched
Reported fixes
The cookie scope forgery issue (CVE-2026-118661) has been resolved in happy-dom version 20.14.6. The SSRF issue (CVE-2026-118660) has been resolved in happy-dom version 21.0.0, which notably postdates the fix for the cookie issue. Applications should update to version 21.0.0 or later to address both vulnerabilities.
How this was built
7 source records were collected, matched and used to prepare the report above.
-
GitHub Advisory Database database
-
GitHub Advisory Database database
-
NVD (NIST) database
-
NVD (NIST) database
-
OSV.dev database
-
OSV.dev database
Revision history
- Published
- Generated
- Published
- Generated
- Published
- Generated
- Published
- Generated