Skip to main content

Happy DOM EUVDEUVD-2026-109189

| CVE-2026-115895 HIGH
Code Injection (CWE-94)
2026-10-23 GitHub_M GHSA-834v-8h66-3h79
8.8
CVSS 3.1 · Vendor: GitHub_M
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Supply crafted module source to Happy DOM
  2. Delivery
    Craft invalid import alias with JSON import attribute
  3. Exploit
    Compiler emits valid default initializer
  4. Execution
    Initializer executes in Node host process
  5. Impact
    Reach 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. missing as injected = <expression>) combined specifically with a JSON module import attribute with { type: 'json' }; per the advisory the JSON attribute is required because it stops the malicious alias from being re-emitted in the ESM circular-import resolver, keeping the generated function syntactically valid, and backtick strings survive the compiler's quote stripping so the injected initializer can reach host APIs. Limiting factors: default deployments (JS evaluation disabled) are not exploitable, the attacker must be able to get module source processed, and affected versions are 17.0.0 through 21.0.3 - upgrading to 21.0.4 removes the path.

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.

This Week Schedule remediation this week. Why: HIGH severity (CVSS 7.0-8.9).
Patch available 0.6% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – 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

happy-dom 17.0.0, < 21.0.4

Affected Packages

npm happy-dom fix: 21.0.4

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

Vendor (GitHub_M) PRIMARY 8.8 HIGH
AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
vuln.today AI 8.8 HIGH

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.

3.1 AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
4.0 AV:N/AC:L/AT:N/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
Red Hat 8.8 HIGH

Primary rating from Vendor (GitHub_M).

CVSS VectorVendor: GitHub_M

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
Required
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
High

Lifecycle Timeline

2
Patch available
Oct 23, 2026 - 22:03 EUVD
CVE Published
Oct 23, 2026 - 21:32 cve.org
HIGH 8.8

DescriptionCVE.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.

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

Why It Matters

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.

Business Impact: Medium
Compensating Controls

Apply vendor patch.

Threat Intelligence Overview

EPSS Score
0.6%
Top 54% exploitable
Prevalence
High
very widely used npm DOM library across JS testing and SSR ecosystems
Threat Intel
1
1 source
Social Media
2
Sightings
Data Quality
6 sources
Confidence: High

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.

SignalValue
Severity HIGH
CISA KEV No
Public POC No
EPSS 0.6%
Patch available Yes
Active threat No
Deciding rule
HIGH severity (CVSS 7.0-8.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Scheduled
Exploitation· derived
None
System Exposure· derived
Open
Automatable· derived
No
Human Impact
Medium

Priority Score

45
Low Medium High Critical
KEV: 0
EPSS: +1
CVSS: +44
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Code Injection CRITICAL

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.

Vendor StatusVendor

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy