IT SBIT Services
Schneeberger
DEEN
CVE tracker

Happy DOM: Code injection via unsanitized import alias in ESM compiler

CVE-2026-115895High 8.8

← All vulnerabilities

Summary

Happy DOM, a JavaScript implementation of a web browser without a graphical user interface, does not validate named ESM import aliases before generating code. If JavaScript evaluation is enabled, attacker-controlled HTML or module source can inject code that runs in the Node.js host process. This is an incomplete fix for CVE-2026-33943 that affects a separate code path.

Affected

  • happy-dom from 17.0.0 up to but not including 21.0.4
  • Unknown whether any 20.x release is affected or fixed; no 20.x fix has been published.

Fixed in

  • Fixed in happy-dom 21.0.4.

Workaround

  • Set enableJavaScriptEvaluation to false when processing untrusted HTML or when scripts are not needed.
  • Run happy-dom in isolated, least-privilege containers or sandboxes when handling untrusted content.
  • No vendor-published workaround beyond these; vendor guidance is to upgrade.

Exploitation

  • A public proof of concept is referenced in the advisory, but sources conflict on its status; not verified.
  • Exploitation in the wild: no evidence found. Not checked against the CISA KEV catalogue.
  • CISA SSVC: exploitation PoC, not automatable, total technical impact.
  • Prerequisites: JavaScript evaluation enabled and attacker-controlled HTML or module content reaching happy-dom; user interaction required.

Our recommendation

  • Identify all happy-dom installations, direct and transitive, using npm ls happy-dom, lockfiles and SBOMs.
  • Prioritise production services that render or scrape untrusted HTML with JavaScript evaluation enabled.
  • Upgrade to 21.0.4 or later and test the 21.x major version change, which alters default behaviour.
  • Until upgraded, disable JavaScript evaluation for untrusted content and isolate affected runners.
  • Development-only installations on CI runners and developer machines that process untrusted content should also be patched.

Public exploits

PoC-in-GitHub, Metasploit and Exploit-DB list nothing for this CVE.

Research sources

Researched and written up in English and German by an AI (Claude by Anthropic) based on NVD, CISA, EPSS and the sources listed. The vendor information is authoritative. Researched on 31 Oct 2026, 10:38.

Original description (NVD)

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.

NVD references (5)

Sources

The tracker combines official, freely usable data sources – updated continuously:

This product uses data from the NVD API but is not endorsed or certified by the NVD. EPSS data © FIRST.org.

Affected? We can help.

We check whether your systems are affected, install updates and close the gap – continuously with the System Health Checker if you wish.