CVE-2025-61927
Happy-DOM has VM Context Escape
Happy DOM is a JavaScript implementation of a web browser without its graphical user interface. Happy DOM v19 and lower contains a security vulnerability that puts the owner system at the risk of RCE (Remote Code Execution) attacks. A Node.js VM Context is not an isolated environment, and if the user runs untrusted JavaScript code within the Happy DOM VM Context, it may escape the VM and get access to process level functionality. It seems like what the attacker can get control over depends on if the process is using ESM or CommonJS. With CommonJS the attacker can get hold of the require() function to import modules. Happy DOM has JavaScript evaluation enabled by default. This may not be obvious to the consumer of Happy DOM and can potentially put the user at risk if untrusted code is executed within the environment. Version 20.0.0 patches the issue by changing JavaScript evaluation to be disabled by default.
Attack profile
How easy it is to exploit
- Attack vector
- Network
- Complexity
- Low
- Privileges needed
- High
- User interaction
- Active
What an attacker can affect
- Confidentiality
- Low
- Integrity
- High
- Availability
- High
Exploit likelihood
What each source reports
CVE List Score used
7.2
Happy-DOM has VM Context Escape
Happy DOM is a JavaScript implementation of a web browser without its graphical user interface. Happy DOM v19 and lower contains a security vulnerability that puts the owner system at the risk of RCE (Remote Code Execution) attacks. A Node.js VM Context is not an isolated environment, and if the user runs untrusted JavaScript code within the Happy DOM VM Context, it may escape the VM and get access to process level functionality. It seems like what the attacker can get control over depends on if the process is using ESM or CommonJS. With CommonJS the attacker can get hold of the require() function to import modules. Happy DOM has JavaScript evaluation enabled by default. This may not be obvious to the consumer of Happy DOM and can potentially put the user at risk if untrusted code is executed within the environment. Version 20.0.0 patches the issue by changing JavaScript evaluation to be disabled by default.
- Record
CVE-2025-61927- CVSS 4.0
- 7.2 High
CVSS:4.0/AV:N/AC:L/AT:P/PR:H/UI:A/VC:L/VI:H/VA:H/SC:H/SI:H/SA:H - Weakness
- CWE-94
- Updated
- 2026-11-02
EUVDEUVD-2025-33777
7.2
Happy DOM is a JavaScript implementation of a web browser without its graphical user interface. Happy DOM v19 and lower contains a security vulnerability that puts the owner system at the risk of RCE (Remote Code Execution) attacks. A Node.js VM Context is not an isolated environment, and if the user runs untrusted JavaScript code within the Happy DOM VM Context, it may escape the VM and get access to process level functionality. It seems like what the attacker can get control over depends on if the process is using ESM or CommonJS. With CommonJS the attacker can get hold of the require() function to import modules. Happy DOM has JavaScript evaluation enabled by default. This may not be obvious to the consumer of Happy DOM and can potentially put the user at risk if untrusted code is executed within the environment. Version 20.0.0 patches the issue by changing JavaScript evaluation to be disabled by default.
- Record
EUVD-2025-33777- CVSS 4.0
- 7.2 High
CVSS:4.0/AV:N/AC:L/AT:P/PR:H/UI:A/VC:L/VI:H/VA:H/SC:H/SI:H/SA:H - Updated
- 2026-11-02
GitHub AdvisoriesGHSA-37j7-fg3j-429f
9.3
Happy DOM: VM Context Escape can lead to Remote Code Execution
Escape of VM Context gives access to process level functionality
Summary
Happy DOM v19 and lower contains a security vulnerability that puts the owner system at the risk of RCE (Remote Code Execution) attacks.
A Node.js VM Context is not an isolated environment, and if the user runs untrusted JavaScript code within the Happy DOM VM Context, it may escape the VM and get access to process level functionality.
It seems like what the attacker can get control over depends on if the process is using ESM or CommonJS. With CommonJS the attacker can get hold of the require() function to import modules.
Happy DOM has JavaScript evaluation enabled by default. This may not be obvious to the consumer of Happy DOM and can potentially put the user at risk if untrusted code is executed within the environment.
Reproduce
CommonJS (Possible to get hold of require)
const { Window } = require('happy-dom');
const window = new Window({ console });
window.document.write(`
<script>
const process = this.constructor.constructor('return process')();
const require = process.mainModule.require;
console.log('Files:', require('fs').readdirSync('.').slice(0,3));
</script>
`);
ESM (Not possible to get hold of import or require)
const { Window } = require('happy-dom');
const window = new Window({ console });
window.document.write(`
<script>
const process = this.constructor.constructor('return process')();
console.log('PID:', process.pid);
</script>
`);
Potential Impact
Server-Side Rendering (SSR)
const { Window } = require('happy-dom');
const window = new Window();
window.document.innerHTML = userControlledHTML;
Testing Frameworks
Any test suite using Happy-DOM with untrusted content may be at risk
Attack Scenarios
- Data Exfiltration: Access to environment variables, configuration files, secrets
- Lateral Movement: Network access for connecting to internal systems. Happy DOM already gives access to the network by fetch, but has protections in place (such as CORS and header validation etc.).
- Code Execution: Child process access for running arbitrary commands
- Persistence: File system access
Recommended Immediate Actions
- Update Happy DOM to v20 or above
- This version has JavaScript evaluation disabled by default
- This version will output a warning if JavaScript is enabled in an insecure environment
- Run Node.js with the "--disallow-code-generation-from-strings" if you need JavaScript evaluation enabled
- This makes sure that evaluation can't be used at process level to escape the VM
eval()andFunction()can still be used within the Happy DOM VM without any known security risk- Happy DOM v20 and above will output a warning if this flag is not in use
- If you can't update Happy DOM right now, it's recommended to disable JavaScript evaluation, unless you completely trust the content within the environment
Technical Root Cause
All classes and functions inherit from Function. By walking the constructor chain it's possible to get hold of Function at process level. As Function can evaluate code from strings, it's possible to execute code at process level.
Running Node with the "--disallow-code-generation-from-strings" flag protects against this.
- Record
GHSA-37j7-fg3j-429f- CVSS 4.0
- 9.3 Critical
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:H/SI:H/SA:H/E:P - Weakness
- CWE-94
- Updated
- 2026-11-02
NVD
7.2
Happy DOM is a JavaScript implementation of a web browser without its graphical user interface. Happy DOM v19 and lower contains a security vulnerability that puts the owner system at the risk of RCE (Remote Code Execution) attacks. A Node.js VM Context is not an isolated environment, and if the user runs untrusted JavaScript code within the Happy DOM VM Context, it may escape the VM and get access to process level functionality. It seems like what the attacker can get control over depends on if the process is using ESM or CommonJS. With CommonJS the attacker can get hold of the require() function to import modules. Happy DOM has JavaScript evaluation enabled by default. This may not be obvious to the consumer of Happy DOM and can potentially put the user at risk if untrusted code is executed within the environment. Version 20.0.0 patches the issue by changing JavaScript evaluation to be disabled by default.
- Record
CVE-2025-61927- CVSS 4.0
- 7.2 High
CVSS:4.0/AV:N/AC:L/AT:P/PR:H/UI:A/VC:L/VI:H/VA:H/SC:H/SI:H/SA:H/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X - Weakness
- CWE-94
- Updated
- 2026-11-02
OSV
7.2
Happy-DOM has VM Context Escape
Happy DOM is a JavaScript implementation of a web browser without its graphical user interface. Happy DOM v19 and lower contains a security vulnerability that puts the owner system at the risk of RCE (Remote Code Execution) attacks. A Node.js VM Context is not an isolated environment, and if the user runs untrusted JavaScript code within the Happy DOM VM Context, it may escape the VM and get access to process level functionality. It seems like what the attacker can get control over depends on if the process is using ESM or CommonJS. With CommonJS the attacker can get hold of the require() function to import modules. Happy DOM has JavaScript evaluation enabled by default. This may not be obvious to the consumer of Happy DOM and can potentially put the user at risk if untrusted code is executed within the environment. Version 20.0.0 patches the issue by changing JavaScript evaluation to be disabled by default.
- Record
CVE-2025-61927- CVSS 4.0
- 7.2 High
CVSS:4.0/AV:N/AC:L/AT:P/PR:H/UI:A/VC:L/VI:H/VA:H/SC:H/SI:H/SA:H - Weakness
- CWE-94
- Updated
- 2026-11-02
OSVGHSA-37j7-fg3j-429f
9.3
Happy DOM: VM Context Escape can lead to Remote Code Execution
Escape of VM Context gives access to process level functionality
Summary
Happy DOM v19 and lower contains a security vulnerability that puts the owner system at the risk of RCE (Remote Code Execution) attacks.
A Node.js VM Context is not an isolated environment, and if the user runs untrusted JavaScript code within the Happy DOM VM Context, it may escape the VM and get access to process level functionality.
It seems like what the attacker can get control over depends on if the process is using ESM or CommonJS. With CommonJS the attacker can get hold of the require() function to import modules.
Happy DOM has JavaScript evaluation enabled by default. This may not be obvious to the consumer of Happy DOM and can potentially put the user at risk if untrusted code is executed within the environment.
Reproduce
CommonJS (Possible to get hold of require)
const { Window } = require('happy-dom');
const window = new Window({ console });
window.document.write(`
<script>
const process = this.constructor.constructor('return process')();
const require = process.mainModule.require;
console.log('Files:', require('fs').readdirSync('.').slice(0,3));
</script>
`);
ESM (Not possible to get hold of import or require)
const { Window } = require('happy-dom');
const window = new Window({ console });
window.document.write(`
<script>
const process = this.constructor.constructor('return process')();
console.log('PID:', process.pid);
</script>
`);
Potential Impact
Server-Side Rendering (SSR)
const { Window } = require('happy-dom');
const window = new Window();
window.document.innerHTML = userControlledHTML;
Testing Frameworks
Any test suite using Happy-DOM with untrusted content may be at risk
Attack Scenarios
- Data Exfiltration: Access to environment variables, configuration files, secrets
- Lateral Movement: Network access for connecting to internal systems. Happy DOM already gives access to the network by fetch, but has protections in place (such as CORS and header validation etc.).
- Code Execution: Child process access for running arbitrary commands
- Persistence: File system access
Recommended Immediate Actions
- Update Happy DOM to v20 or above
- This version has JavaScript evaluation disabled by default
- This version will output a warning if JavaScript is enabled in an insecure environment
- Run Node.js with the "--disallow-code-generation-from-strings" if you need JavaScript evaluation enabled
- This makes sure that evaluation can't be used at process level to escape the VM
eval()andFunction()can still be used within the Happy DOM VM without any known security risk- Happy DOM v20 and above will output a warning if this flag is not in use
- If you can't update Happy DOM right now, it's recommended to disable JavaScript evaluation, unless you completely trust the content within the environment
Technical Root Cause
All classes and functions inherit from Function. By walking the constructor chain it's possible to get hold of Function at process level. As Function can evaluate code from strings, it's possible to execute code at process level.
Running Node with the "--disallow-code-generation-from-strings" flag protects against this.
- Record
GHSA-37j7-fg3j-429f- CVSS 4.0
- 9.3 Critical
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:H/SI:H/SA:H/E:P - Weakness
- CWE-94
- Updated
- 2026-11-02
Show 10 moreShow less
OSVCLSA-2026-1782781184 No score
TuxCare security update for happy-dom (3 CVEs)
TuxCare rebuilt happy-dom to address 3 CVEs. Fixed in 9.10.9-tuxcare.1.
- Record
CLSA-2026-1782781184- Updated
- 2026-11-02
OSVCLSA-2026-1787835578 No score
TuxCare security update for happy-dom (2 CVEs)
TuxCare rebuilt happy-dom to address 2 CVEs. Fixed in 15.11.7-tuxcare.1.
- Record
CLSA-2026-1787835578- Updated
- 2026-11-02
OSVCLSA-2026-1789467187 No score
TuxCare security update for happy-dom (1 CVE)
TuxCare rebuilt happy-dom to address 1 CVE. Fixed in 9.20.3-tuxcare.1.
- Record
CLSA-2026-1789467187- Updated
- 2026-11-02
OSVCLSA-2026-1792254607 No score
TuxCare security update for @happy-dom/global-registrator (3 CVEs)
TuxCare rebuilt @happy-dom/global-registrator to address 3 CVEs. Fixed in 9.10.9-tuxcare.1.
- Record
CLSA-2026-1792254607- Updated
- 2026-11-02
OSVCLSA-2026-1792254618 No score
TuxCare security update for @happy-dom/global-registrator (2 CVEs)
TuxCare rebuilt @happy-dom/global-registrator to address 2 CVEs. Fixed in 15.11.7-tuxcare.1.
- Record
CLSA-2026-1792254618- Updated
- 2026-11-02
OSVCLSA-2026-1792254627 No score
TuxCare security update for @happy-dom/global-registrator (1 CVE)
TuxCare rebuilt @happy-dom/global-registrator to address 1 CVE. Fixed in 9.20.3-tuxcare.1.
- Record
CLSA-2026-1792254627- Updated
- 2026-11-02
OSVCLSA-2026-1792866906 No score
TuxCare security update for @happy-dom/jest-environment (3 CVEs)
TuxCare rebuilt @happy-dom/jest-environment to address 3 CVEs. Fixed in 9.10.9-tuxcare.1.
- Record
CLSA-2026-1792866906- Updated
- 2026-11-02
OSVCLSA-2026-1792866907 No score
TuxCare security update for @happy-dom/jest-environment (3 CVEs)
TuxCare rebuilt @happy-dom/jest-environment to address 3 CVEs. Fixed in 14.12.3-tuxcare.2.
- Record
CLSA-2026-1792866907- Updated
- 2026-11-02
OSVCLSA-2026-1792866938 No score
TuxCare security update for @happy-dom/jest-environment (2 CVEs)
TuxCare rebuilt @happy-dom/jest-environment to address 2 CVEs. Fixed in 15.11.7-tuxcare.1.
- Record
CLSA-2026-1792866938- Updated
- 2026-11-02
OSVCLSA-2026-1792866960 No score
TuxCare security update for @happy-dom/jest-environment (1 CVE)
TuxCare rebuilt @happy-dom/jest-environment to address 1 CVE. Fixed in 9.20.3-tuxcare.1.
- Record
CLSA-2026-1792866960- Updated
- 2026-11-02
Affected products
Affected packages
| Package | Affected | Fixed |
|---|---|---|
happy-domnpm |
before 20.0.0 | 20.0.0 |
happy-domTuxCare:npm From an advisory covering 3 CVEs |
9.10.9-tuxcare.0 up to 9.10.9-tuxcare.1, plus listed versions 9.10.9 |
9.10.9-tuxcare.1 |
happy-domTuxCare:npm From an advisory covering 2 CVEs |
15.11.7-tuxcare.0 up to 15.11.7-tuxcare.1, plus listed versions 15.11.7 |
15.11.7-tuxcare.1 |
happy-domTuxCare:npm |
9.20.3-tuxcare.0 up to 9.20.3-tuxcare.1, plus listed versions 9.20.3 |
9.20.3-tuxcare.1 |
@happy-dom/global-registratorTuxCare:npm From an advisory covering 3 CVEs |
9.10.9-tuxcare.0 up to 9.10.9-tuxcare.1, plus listed versions 9.10.9 |
9.10.9-tuxcare.1 |
@happy-dom/global-registratorTuxCare:npm From an advisory covering 2 CVEs |
15.11.7-tuxcare.0 up to 15.11.7-tuxcare.1, plus listed versions 15.11.7 |
15.11.7-tuxcare.1 |
@happy-dom/global-registratorTuxCare:npm |
9.20.3-tuxcare.0 up to 9.20.3-tuxcare.1, plus listed versions 9.20.3 |
9.20.3-tuxcare.1 |
@happy-dom/jest-environmentTuxCare:npm From an advisory covering 3 CVEs |
9.10.9-tuxcare.0 up to 9.10.9-tuxcare.1, plus listed versions 9.10.9 |
9.10.9-tuxcare.1 |
@happy-dom/jest-environmentTuxCare:npm From an advisory covering 3 CVEs |
14.12.3-tuxcare.0 up to 14.12.3-tuxcare.2, plus listed versions 14.12.3 |
14.12.3-tuxcare.2 |
@happy-dom/jest-environmentTuxCare:npm From an advisory covering 2 CVEs |
15.11.7-tuxcare.0 up to 15.11.7-tuxcare.1, plus listed versions 15.11.7 |
15.11.7-tuxcare.1 |
@happy-dom/jest-environmentTuxCare:npm |
9.20.3-tuxcare.0 up to 9.20.3-tuxcare.1, plus listed versions 9.20.3 |
9.20.3-tuxcare.1 |
History
| Recorded | Changed | Sources |
|---|---|---|
| affected, facts | ||
| first indexed | CVE List, EUVD, GitHub Advisories, NVD, OSV |
Dates are when Every CVE recorded each change. Upstream dates may differ.
In short
CVE-2025-61927 is a high vulnerability (CVSS 7.2) in Capricorn86 Happy-dom, published October 10, 2025. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 0.64%, the 51st percentile. Fixed in happy-dom 20.0.0.
References
github.com/capricorn86/happy-dom/security/advisories/GHSA-37j7-fg3j-429f
github.com/capricorn86/happy-dom/commit/819d15ba289495439eda8be360d92a614ce22405
nvd.nist.gov/vuln/detail/CVE-2025-61927
github.com/capricorn86/happy-dom/commit/de438ad72921c69793584aa657b48d3655dfac97
github.com/capricorn86/happy-dom/releases/tag/v20.0.0
github.com/advisories/GHSA-37j7-fg3j-429f
github.com/CVEProject/cvelistV5/tree/main/cves/2025/61xxx/CVE-2025-61927.json
github.com/capricorn86/happy-dom