chore(deps): update dependency happy-dom to v20.8.8 [security]#182
chore(deps): update dependency happy-dom to v20.8.8 [security]#182renovate[bot] merged 1 commit intomainfrom
Conversation
|
View your CI Pipeline Execution ↗ for commit b43f530
☁️ Nx Cloud last updated this comment at |
|
Important Review skippedReview was skipped due to path filters ⛔ Files ignored due to path filters (1)
CodeRabbit blocks several paths by default. You can override this behavior by explicitly including those paths in the path filters. For example, including ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Comment |
This PR contains the following updates:
20.8.4→20.8.8GitHub Vulnerability Alerts
CVE-2026-33943
Summary
A code injection vulnerability in
ECMAScriptModuleCompilerallows an attacker to achieve Remote Code Execution (RCE) by injecting arbitrary JavaScript expressions insideexport { }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.Details
Vulnerable file:
packages/happy-dom/src/module/ECMAScriptModuleCompiler.ts, lines 371-385The "Export object" handler extracts content from
export { ... }using the regexexport\s*{([^}]+)}, then generates executable code by directly interpolating it:The issue has three root causes:
STATEMENT_REGEXPuses{[^}]+}which matches any content inside braces, not just valid JavaScript identifiersimportNameis placed in code context (as a JS expression to evaluate), not in string context.replace(/["']/g, '')strips"and'but not backticks, so template literal strings like`child_process`survive the filterAttack flow:
Note: This is a different vulnerability from CVE-2024-51757 (SyncFetchScriptBuilder injection) and CVE-2025-61927 (VM context escape). Those were patched in v15.10.2 and v20.0.0 respectively, but this vulnerable code path in
ECMAScriptModuleCompilerremains present in v20.8.4 (latest). In v20.0.0+ where JavaScript evaluation is disabled by default, this vulnerability is exploitable when JavaScript evaluation is explicitly enabled by the user.PoC
Standalone PoC script — reproduces the vulnerability without installing happy-dom by replicating the compiler's exact code generation logic:
Execution result:
HTML attack vector — when processed by happy-dom with JavaScript evaluation enabled:
Impact
An attacker who can inject or control HTML content processed by happy-dom (with JavaScript evaluation enabled) can achieve arbitrary command execution on the host system.
Realistic attack scenarios:
Suggested fix: Validate that
importNameis a valid JavaScript identifier before interpolating it into generated code:Release Notes
capricorn86/happy-dom (happy-dom)
v20.8.8Compare Source
👷♂️ Patch fixes
v20.8.7Compare Source
v20.8.6Compare Source
v20.8.5Compare Source
Configuration
📅 Schedule: Branch creation - "" (UTC), Automerge - At any time (no schedule defined).
🚦 Automerge: Enabled.
♻ Rebasing: Whenever PR is behind base branch, or you tick the rebase/retry checkbox.
🔕 Ignore: Close this PR and you won't be reminded about this update again.
This PR was generated by Mend Renovate. View the repository job log.