{"id":"CVE-2026-115895","published":"2026-10-23T21:32:24Z","modified":"2026-10-30T18:43:41Z","title":"Happy DOM: Incomplete fix for CVE-2026-33943: unsanitized import alias leads to host code execution","vendor":"capricorn86","product":"happy-dom","tier":"tail","description":{"text":"Happy DOM is a JavaScript implementation of a web browser without its graphical user interface. From 17.0.0 until 21.0.4, packages/happy-dom/src/module/ECMAScriptModuleCompiler.ts accepts a named ESM import alias without validating that it is a JavaScript binding identifier before inserting it into a generated destructuring binding. With enableJavaScriptEvaluation enabled, attacker-controlled HTML or module source can use an invalid alias that becomes a valid default initializer after compilation, causing the generated JavaScript to execute in the Node.js host process. The demonstrated reachable path uses a JSON module import attribute, which prevents the malicious alias from being emitted again in a later ESM circular-import assignment and keeps the generated function syntactically valid. This incomplete fix for CVE-2026-33943 is a distinct residual path because the earlier remediation validated the local export importName path but not the named-import alias. This issue is fixed in version 21.0.4.","provenance":"source","from":"CVE.org"},"cvss":{"score":8.8,"severity":"HIGH","version":"3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H","provenance":"source","from":"CVE.org CNA"},"epss":{"score":0.00473,"percentile":0.41816,"provenance":"source"},"cwes":[{"id":"CWE-94","name":"Improper Control of Generation of Code"}],"references":[{"url":"https://github.com/capricorn86/happy-dom/security/advisories/GHSA-834v-8h66-3h79","tags":["x_refsource_CONFIRM"]},{"url":"https://github.com/capricorn86/happy-dom/pull/2537","tags":["x_refsource_MISC"]},{"url":"https://github.com/capricorn86/happy-dom/commit/fd163520b74d9fa146be91f7b4e4f46d6cccbe13","tags":["x_refsource_MISC"]},{"url":"https://github.com/capricorn86/happy-dom/releases/tag/v21.0.4","tags":["x_refsource_MISC"]}],"priority":{"score":14.5,"factors":[{"name":"EPSS percentile","points":8.36},{"name":"CVSS severity","points":6.16}]},"vendorSlug":"capricorn86","affectedVersions":[{"vendor":"capricorn86","product":"happy-dom","versions":[">= 17.0.0, < 21.0.4"]}],"ssvc":{"exploitation":"poc","automatable":"no","technicalImpact":"total","timestamp":"2026-10-30T18:43:36.234800Z","from":"CISA ADP","provenance":"source"},"affected":[{"ecosystem":"npm","package":"happy-dom","vulnerableRanges":[">=17.0.0, <21.0.4"],"patched":["21.0.4"],"from":["GHSA-834v-8h66-3h79"],"provenance":"source"}],"euvd":{"id":"EUVD-2026-109189","exploited":false,"provenance":"source"},"lineage":{"familyId":"fam-capricorn86-happy-dom-cve-2025-61927","parents":[{"from":"CVE-2026-33943","to":"CVE-2026-115895","relation":"incomplete-fix","confidence":"high","kind":"lineage","evidence":[{"kind":"text","provenance":"source","relation":"incomplete-fix","quote":"This incomplete fix for CVE-2026-33943 is a distinct residual path because the earlier remediation validated the local export importName path but not the named-import alias.","from":"CVE.org","in":"CVE-2026-115895"},{"kind":"same-code","provenance":"machine","files":["packages/happy-dom/src/module/ECMAScriptModuleCompiler.ts"],"commits":["https://github.com/capricorn86/happy-dom/commit/fd163520b74d9fa146be91f7b4e4f46d6cccbe13","https://github.com/capricorn86/happy-dom/commit/5437fdf8f13adb9590f9f52616d9f69c3ee8db3c"],"basis":"shared function","functions":["ECMAScriptModuleCompiler"]}]},{"from":"CVE-2025-61927","to":"CVE-2026-115895","relation":"related","confidence":"medium","kind":"lineage","evidence":[{"kind":"same-code","provenance":"machine","files":["packages/happy-dom/src/module/ECMAScriptModuleCompiler.ts"],"commits":["https://github.com/capricorn86/happy-dom/commit/819d15ba289495439eda8be360d92a614ce22405","https://github.com/capricorn86/happy-dom/commit/de438ad72921c69793584aa657b48d3655dfac97","https://github.com/capricorn86/happy-dom/commit/fd163520b74d9fa146be91f7b4e4f46d6cccbe13"],"basis":"shared function","functions":["ECMAScriptModuleCompiler"]}]}],"children":[{"from":"CVE-2026-115895","to":"CVE-2026-118661","relation":"related","confidence":"medium","kind":"lineage","evidence":[{"kind":"same-code","provenance":"machine","files":["packages/happy-dom/src/cookie/PublicSuffixList.ts","packages/happy-dom/src/css/declaration/CSSPropertyList.ts","packages/happy-dom/src/css/declaration/ICSSStyleDeclaration.ts"],"commits":["https://github.com/capricorn86/happy-dom/commit/fd163520b74d9fa146be91f7b4e4f46d6cccbe13","https://github.com/capricorn86/happy-dom/commit/f21dbd7d0a0c63cdd41954ba5d0f05def4e0f2b3"],"basis":"shared function","functions":["ICSSStyleDeclaration"]}]}],"packageHistory":[{"cve":"CVE-2026-34226","published":"2026-03-27","fixed":"20.8.9","kev":false},{"cve":"CVE-2026-118661","published":"2026-10-28","fixed":"20.14.6","kev":false},{"cve":"CVE-2026-118660","published":"2026-10-28","fixed":"21.0.0","kev":false,"link":{"from":"CVE-2026-118660","to":"CVE-2026-115895","relation":"successor","confidence":"low","kind":"sequence","orderedBy":"description","evidence":[{"kind":"version-step","provenance":"source","package":"npm:happy-dom","fromFixed":"21.0.0","toFixed":"21.0.4","daysApart":-5}]}},{"cve":"CVE-2026-115895","published":"2026-10-23","fixed":"21.0.4","kev":false}],"package":"npm:happy-dom"}}