Safeguard
Vulnerability Analysis•

CVE-2026-33943: Code Injection in happy-dom Module Compiler

CVE-2026-33943 (CVSS 8.8) is code injection in happy-dom's ES module compiler, versions 15.10.0 to 20.8.7. Upgrade to 20.8.8 and isolate scraping jobs.

Safeguard Security Team
2 min read

CVE-2026-33943 is a code injection flaw in happy-dom, a JavaScript implementation of a browser without a graphical interface. NVD scores it 8.8. Crafted export declarations in ES module scripts can run code. Upgrade to 20.8.8. The affected range is 15.10.0 through 20.8.7.

What's affected

Versions 15.10.0 through 20.8.7 are affected, and 20.8.8 is patched. The issue is in ECMAScriptModuleCompiler, which interpolated content from export { } declarations into generated code as an executable expression. The quote filter did not strip backticks, so template literal content slipped through. The CVSS vector needs user interaction.

happy-dom is often a dev and test dependency, but also used for server side rendering and scraping, which handle outside content.

How to check if you're exposed

npm ls happy-dom

Check whether any code path loads ES module scripts from content you do not control.

What to do now

  1. Upgrade happy-dom to 20.8.8 or later.
  2. Do not process untrusted pages in the same process as secrets.
  3. Run scraping and rendering jobs in isolated containers.
  4. Check lockfiles in CI and in tooling images.

Why it matters

The record uses CWE-94 and CWE-917, code injection and expression language injection. Building code from strings, then running it, invites this. Parsing input into data structures avoids it. The record is not marked as exploited in the wild and is not in CISA KEV.

For a library used mostly in tests and rendering, the key question is what content it loads. A test suite that renders your own components carries little risk. A crawler or server side renderer that loads pages from the web carries more. Check the places in your repositories where happy-dom is used and note which of them handle outside content, then prioritize those for the upgrade.

Try it yourself

Click through it at your own pace, or open it full screen.

Quick check

Is a test only dependency safe to ignore?

Not if tests load untrusted content. Upgrade anyway, since the fix is a patch release.

Sources

Last reviewed: 19 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.