Executive brief
Happy DOM, a tool used to simulate web browser environments for testing and automation, contains a flaw that can leak sensitive login information. When making web requests, the software may incorrectly send cookies belonging to the current page to a completely different destination. This could allow an attacker to intercept session tokens or private user data if they can influence where the software sends its requests.
Technical details
A vulnerability exists in Happy DOM's fetch implementation where the 'credentials: include' option causes the library to attach cookies from the current window.location (Origin A) to a request targeting a different destination (Origin B). The root cause is located in the FetchRequestHeaderUtility and CookieContainer components, which failed to properly validate that cookies matched the target request URL before inclusion. An attacker who can control the destination of a fetch request initiated within a Happy DOM environment can capture cookies belonging to the environment's current origin. This issue is fixed in version 20.8.9 by ensuring cookie matching logic strictly adheres to the target URL.
Affected products
- capricorn86 happy-dom < 20.8.9
- Red Hat Red Hat Ansible Automation Platform 2 2
Timeline
- 2026-03-26: patched: Version 20.8.9 released to address the cookie leakage.
- 2026-03-27: disclosed: Security advisory published.
References
- https://github.com/capricorn86/happy-dom/blob/f8d8cad41e9722fab9eefb9dfb3cca696462e908/packages/happy-dom/src/fetch/utilities/FetchRequestHeaderUtility.ts
- https://github.com/capricorn86/happy-dom/commit/68324c21d7b98f53f7bb5a7b3e185bda7106e751
- https://github.com/capricorn86/happy-dom/pull/2117
- https://github.com/capricorn86/happy-dom/releases/tag/v20.8.9
- https://github.com/capricorn86/happy-dom/security/advisories/GHSA-w4gp-fjgq-3q4g
- https://access.redhat.com/security/cve/CVE-2026-34226
- https://bugzilla.redhat.com/show_bug.cgi?id=2452519