Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessSupply crafted module source to Happy DOM
-
DeliveryCraft invalid import alias with JSON import attribute
-
ExploitCompiler emits valid default initializer
-
ExecutionInitializer executes in Node host process
-
ImpactReach process and node:fs for RCE
Vulnerability Assessment
| Weakness |
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V1 - Encoding and Sanitization Code injection prevention, sandbox exec
MITRE ATT&CK
2 techniques across 2 tactics: Execution, Initial Access The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up. |
| Exploitation Conditions | Exploitation requires that the application set enableJavaScriptEvaluation:true (NOT the default) and pass attacker-controlled HTML or ESM module source into Happy DOM - e.g. SSR, preview, scraping or testing services that evaluate externally supplied HTML. The concrete trigger is a named ESM import alias that is not a valid JavaScript binding identifier (e.g. |
| Impact | This is a genuine high-severity remote code execution flaw (CWE-94) rather than an inflated CVSS score, but its real-world urgency is strongly gated by a non-default configuration. The provided CVSS 3.1 vector (AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H, 8.8) indicates a network-reachable, low-complexity, unauthenticated issue with full confidentiality, integrity and availability impact because the injected expression runs in the Node.js host process. Those impact metrics are well supported: the GHSA advisory includes a complete, tested proof-of-concept that reaches node:process and node:fs and creates a directory on the host. Signals are mixed on likelihood: there is NO CISA KEV entry and NO EPSS score in the input, so there is no evidence of active or widespread exploitation, and the vuln.today Decision label is 'this_week' (not act_now/emergency). The dominant limiting factor is that exploitation requires enableJavaScriptEvaluation:true, which is not the default, plus the application must feed attacker-controlled HTML/module source to Happy DOM - so the exploitable population is narrower than AV:N/PR:N alone suggests. Net: treat as a prompt (this-week) patching priority for any SSR, preview, scraping or test service that evaluates externally supplied HTML, and as low urgency where JS evaluation is disabled. Note the official vector's UI:R reflects that an application must process attacker content; for fully automated services that ingest untrusted HTML there may be no genuine human interaction, which would make real risk slightly higher than the 8.8 implies. |
| Exploit ScenarioDerived | A service (SSR renderer, link-preview generator, web scraper, or test harness) runs Happy DOM with enableJavaScriptEvaluation:true and processes attacker-supplied HTML containing a <script type="module">. The attacker crafts a named ESM import alias that is invalid JavaScript syntax but, combined with a JSON import attribute (with { type: 'json' }), the compiler rewrites it into a valid destructuring default initializer that executes, reaching node:process and node:fs for host code execution. A complete, tested public PoC exists in the GHSA advisory. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – Oct 23, 2026
Code injection in Happy DOM 17.0.0 through 21.0.3 allows attacker-supplied module source to execute in the Node.js host process when a Window is created with enableJavaScriptEvaluation: true. A named ESM import alias that is not a valid JavaScript binding identifier is spliced unvalidated into a generated destructuring binding, and combined with a JSON module import attribute the compiled function remains syntactically valid and runs the attacker's initializer - the advisory's proof of concept reaches process.getBuiltinModule('node:fs') and creates a directory on the host filesystem. The issue is a distinct residual path left open by the fix for CVE-2026-33943, rated CVSS 8.8 (AV:N/AC:L/PR:N/UI:R) with user interaction required; the vendor shipped 21.0.4, no CISA KEV entry is associated, and real-world exposure is gated by the non-default JavaScript evaluation setting plus the need to process attacker-controlled HTML or module source.
RemediationAI
Vendor-released patch: upgrade happy-dom to 21.0.4 or later (release https://github.com/capricorn86/happy-dom/releases/tag/v21.0.4), which corresponds to PR https://github.com/capricorn86/happy-dom/pull/2537 and commit https://github.com/capricorn86/happy-dom/commit/fd163520b74d9fa146be91f7b4e4f46d6cccbe13; the advisory at https://github.com/capricorn86/happy-dom/security/advisories/GHSA-834v-8h66-3h79 documents the change, which extends the existing VALID_VARIABLE_NAME_REGEXP check to the named-import alias (VALID_VARIABLE_NAME_REGEXP.test(alias)) and recommends using JSON.stringify for generated property keys as extra hardening. Note that applying only the earlier CVE-2026-33943 remediation is insufficient, since that fix validated the export handler's importName and left this alias path open. Where immediate upgrading is not possible, keep enableJavaScriptEvaluation at its default of false and never process untrusted HTML or module source with script evaluation turned on - the trade-off is that any feature relying on executing page scripts in the simulated DOM (SSR script execution, HTML preview, script-dependent scraping or test assertions) stops working. Restricting the sources from which Happy DOM may load modules and refusing JSON module imports with with { type: 'json' } attributes in untrusted markup also removes the demonstrated trigger, but such filtering must be applied before the compiler sees the source and is bypassable if any unfiltered path remains.
Affected VersionsENISA
Affected Packages
Source: OSV (Open Source Vulnerabilities)
Affects your stack
Affects 1 package in npm
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
The flaw lives in packages/happy-dom/src/module/ECMAScriptModuleCompiler.ts, the ESM compiler introduced by commit 7bc831df2 and first shipped in v17.0.0. The named-import handler splits an import specifier on ' as ', strips quote characters from both halves, and pushes { name, alias } without ever testing the alias against a JavaScript binding-identifier pattern. The alias is then interpolated straight into generated binding syntax of the form let {"name": alias} = $happy_dom.imports.get(url), so a specifier such as missing as injected = globalThis.__HAPPY_DOM_PWNED__ = 1337 - rejected by Node.js at the '=' token - becomes a valid destructuring default initializer that fires because the imported JSON object has no such property. This is CWE-94 (improper control of generation of code): the root cause is code generation from unvalidated input rather than a memory-safety or parsing bug. The with { type: 'json' } attribute is load-bearing, because the compiler only builds its circular-import resolver when the import is ESM or untyped, so a JSON module stops the malicious alias from being re-emitted in a later assignment and keeps the generated function syntactically valid; backtick strings additionally survive the compiler's quote stripping, which lets the payload call globalThis.constructor.constructor('return process')() and pull in node:fs. CVE-2026-33943 patched the export { ... } handler by validating importName with VALID_VARIABLE_NAME_REGEXP, but the named-import alias path was left untouched, which is why versions released after that fix, including 20.14.5, remain reproducible. The advisory records direct testing against 17.0.0, 20.0.0, 20.1.0 and 20.14.5, with 16.8.1 confirmed unaffected.
Know when Happy Dom gets its next vulnerability
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
Severity by source
AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
Deterministic injection once attacker content is processed (AC:L), no target privileges (PR:N), but the app must ingest attacker module source (UI:R); injected code runs in the Node host giving full C:H/I:H/A:H.
Primary rating from Vendor (GitHub_M).
CVSS VectorVendor: GitHub_M
Lifecycle Timeline
2DescriptionCVE.org
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.
Articles & Coverage 1
Technical POC Analysis
CWE-94 (Improper Control of Generation of Code).
Full technical POC analysis - root cause, step-by-step exploitation and patch breakdown - is part of the Pro and Business plans.
Executive ViewAI
The Happy DOM library, used for simulating web environments in Node.js testing and server-side rendering, contains a code injection flaw (CVE-2026-115895) that can lead to remote code execution on the host when JavaScript evaluation is enabled. This affects development and production systems that process untrusted HTML or module content with that non-default setting, potentially allowing an attacker to compromise the host and access sensitive data or operations. Leadership should prioritize remediation because exploitation could result in unauthorized access and disruption, though the requirement for user interaction and the non-default configuration reduce the likelihood of widespread attacks.
Apply vendor patch.
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
Code injection occurs when an application accepts user input and passes it directly into a language interpreter or evaluator without proper sanitization.
Remote Code Execution represents the critical moment when an attacker successfully runs arbitrary code on a target system without physical access.
Server-side request forgery in happy-dom (versions up to and including 20.14.6) lets a remote attacker force the Node.js
Cookie leakage in Happy DOM JavaScript library (all versions prior to 20.8.9) allows remote attackers to steal authentic
Server-side request forgery in Happy DOM's @happy-dom/server-renderer package (versions <= 21.0.1) lets unauthenticated
Cookie scope forgery in Happy DOM 20.14.5 and earlier lets an attacker-controlled origin plant a cookie that a victim or
EUVD-2026-109189
GHSA-834v-8h66-3h79
NVD
CVE.org
EPSS
VulDB
Exploit-DB