Skip to main content
Press slash or control plus K to focus the search. Use the arrow keys to navigate results and press enter to open a threat.
Reconnecting to live updates…

CVE-2026-33943: CWE-94: Improper Control of Generation of Code ('Code Injection') in capricorn86 happy-dom

0
High
VulnerabilityCVE-2026-33943cvecve-2026-33943cwe-94
Published: Fri Mar 27 2026 (03/27/2026, 21:15:19 UTC)
Source: CVE Database V5
Vendor/Project: capricorn86
Product: happy-dom

Description

Happy DOM is a JavaScript implementation of a web browser without its graphical user interface. In versions 15.10.0 through 20.8.7, a code injection vulnerability in `ECMAScriptModuleCompiler` allows an attacker to achieve Remote Code Execution (RCE) by injecting arbitrary JavaScript expressions inside `export { }` declarations in ES module scripts processed by happy-dom. The compiler directly interpolates unsanitized content into generated code as an executable expression, and the quote filter does not strip backticks, allowing template literal-based payloads to bypass sanitization. Version 20.8.8 fixes the issue.

AI-Powered Analysis

Machine-generated threat intelligence

AILast updated: 03/27/2026, 21:45:34 UTC

Technical Analysis

Happy DOM is a JavaScript library that simulates a web browser environment without a graphical user interface, often used for server-side rendering, testing, or automation. Versions 15.10.0 through 20.8.7 contain a critical code injection vulnerability (CWE-94) in the ECMAScriptModuleCompiler module. This component compiles ES module scripts and processes export declarations. The vulnerability stems from the compiler directly interpolating unsanitized user-controlled JavaScript expressions inside export { } statements. The sanitization mechanism, specifically the quote filter, does not remove backticks (`), which allows attackers to craft payloads using template literals that bypass filtering. By injecting malicious JavaScript expressions, an attacker can achieve remote code execution (RCE) within the context where happy-dom is used. Exploitation requires user interaction (e.g., supplying malicious module scripts) but no prior authentication, making it accessible to remote attackers. The vulnerability impacts confidentiality, integrity, and availability by enabling arbitrary code execution, potentially leading to data theft, system compromise, or denial of service. The issue was fixed in version 20.8.8 by properly sanitizing input and preventing unsafe code interpolation. No known exploits are currently reported in the wild, but the high CVSS score (8.8) reflects the severity and ease of exploitation.

Potential Impact

This vulnerability allows remote attackers to execute arbitrary JavaScript code in environments using vulnerable versions of happy-dom, potentially leading to full system compromise. Organizations relying on happy-dom for server-side rendering, automated testing, or any backend JavaScript execution are at risk of data breaches, unauthorized access, and service disruption. The attack could be leveraged to pivot within networks, deploy malware, or exfiltrate sensitive information. Because happy-dom is used in development and CI/CD pipelines, compromised environments could lead to supply chain risks affecting downstream applications. The lack of authentication requirement and network attack vector increases the threat surface. The vulnerability's impact spans confidentiality, integrity, and availability, making it critical for organizations to address promptly.

Mitigation Recommendations

The primary mitigation is to upgrade happy-dom to version 20.8.8 or later, where the vulnerability is patched. Organizations should audit their codebases and dependencies to identify usage of affected versions. If immediate upgrade is not feasible, restrict access to environments running happy-dom to trusted users and networks to reduce exposure. Implement input validation and sanitization on any user-supplied module scripts processed by happy-dom. Employ runtime application self-protection (RASP) or sandboxing techniques to limit the impact of potential code execution. Monitor logs and network traffic for suspicious activity related to module compilation or unexpected code execution. Incorporate static and dynamic code analysis tools to detect unsafe code injection patterns. Finally, educate developers about secure coding practices to prevent injection flaws in custom extensions or integrations.

Pro Console: star threats, build custom feeds, automate alerts via Slack, email & webhooks.Upgrade to Pro

Technical Details

Data Version
5.2
Assigner Short Name
GitHub_M
Date Reserved
2026-03-24T19:50:52.104Z
Cvss Version
3.1
State
PUBLISHED

Threat ID: 69c6f6ca3c064ed76ff81bae

Added to database: 3/27/2026, 9:29:46 PM

Last enriched: 3/27/2026, 9:45:34 PM

Last updated: 3/27/2026, 11:02:14 PM

Views: 5

Community Reviews

0 reviews

Crowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.

Sort by
Loading community insights…

Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.

Actions

PRO

Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.

Please log in to the Console to use AI analysis features.

Need more coverage?

Upgrade to Pro Console for AI refresh and higher limits.

For incident response and remediation, OffSeq services can help resolve threats faster.

Latest Threats

Breach by OffSeqOFFSEQFRIENDS — 25% OFF

Check if your credentials are on the dark web

Instant breach scanning across billions of leaked records. Free tier available.

Scan now
OffSeq TrainingCredly Certified

Lead Pen Test Professional

Technical5-day eLearningPECB Accredited
View courses