# CVE-2025-62410: --disallow-code-generation-from-strings is not sufficient for isolating untrusted JavaScript in happy-dom

> Attackers can execute arbitrary code and escalate privileges via prototype pollution in happy-dom due to insufficient isolation of untrusted JavaScript.

- **Severity:** Critical 9.4 (`CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:P/VC:H/VI:H/VA:H/SC:H/SI:H/SA:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Over the internet
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 15 Oct 2025
- **Updated:** 15 Oct 2025
- **Also known as:** GHSA-qpm2-6cq5-7pq5

## What is CVE-2025-62410?

CVE-2025-62410 is a critical code injection vulnerability in capricorn86 happy-dom, published on 15 Oct 2025. Any signed-in user can exploit it over the network, and only if a user opens a file or follows a link.

### Official description

In versions before 20.0.2, it was found that --disallow-code-generation-from-strings is not sufficient for isolating untrusted JavaScript in happy-dom. The untrusted script and the rest of the application still run in the same Isolate/process, so attackers can deploy prototype pollution payloads to hijack important references like "process" in the example below, or to hijack control flow via flipping checks of undefined property. This vulnerability is due to an incomplete fix for CVE-2025-61927. The vulnerability is fixed in 20.0.2.

Weakness: CWE-1321 (Improperly Controlled Modification of Object Prototype Attributes)

## Which versions are affected by CVE-2025-62410?

2 open source packages ship an affected version, including happy-dom.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `happy-dom` | npm | From 19.0.0 | 20.0.2 |
| `happy-dom` | npm | From 19.0.0 | 20.0.2 |

## How do I fix CVE-2025-62410?

Upgrade happy-dom to 20.0.2 or later.

## Is CVE-2025-62410 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2025-62410 exists.

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2025-62410 and fix it if it is affected.

What it is: CVE-2025-62410 is a critical code injection vulnerability in capricorn86 happy-dom, published on 15 Oct 2025. Any signed-in user can exploit it over the network, and only if a user opens a file or follows a link.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2025-62410 exists.

Affected packages and fixed versions:
- happy-dom (npm): affected from 19.0.0; fixed in 20.0.2
- happy-dom (npm): affected from 19.0.0; fixed in 20.0.2

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2025-62410/ (Markdown: https://insights.sbomify.com/CVE-2025-62410/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2025-62410
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2025-62410
- OSV: https://osv.dev/vulnerability/CVE-2025-62410

---
From sbomify Insights: https://insights.sbomify.com/CVE-2025-62410/
Summaries are generated and may contain mistakes; the official description above is the record.
