# CVE-2025-54782: @nestjs/devtools-integration's CSRF to Sandbox Escape Allows for RCE against JS Developers

> A malicious website can trigger remote code execution on a developer's machine via an unsafe sandbox in the NestJS devtools integration package.

- **Severity:** Critical 9.4 (`CVSS:4.0/AV:A/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:H/SI:H/SA:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Local or same network only
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 1 Aug 2025
- **Updated:** 4 Aug 2025
- **Also known as:** GHSA-85cg-cmq5-qjm7

## What is CVE-2025-54782?

CVE-2025-54782 is a critical code injection vulnerability in nestjs nest, published on 1 Aug 2025. It can only be exploited from the same machine or local network, with no action from the victim.

### Official description

Nest is a framework for building scalable Node.js server-side applications. In versions 0.2.0 and below, a critical Remote Code Execution (RCE) vulnerability was discovered in the @nestjs/devtools-integration package. When enabled, the package exposes a local development HTTP server with an API endpoint that uses an unsafe JavaScript sandbox (safe-eval-like implementation). Due to improper sandboxing and missing cross-origin protections, any malicious website visited by a developer can execute arbitrary code on their local machine. The package adds HTTP endpoints to a locally running NestJS development server. One of these endpoints, /inspector/graph/interact, accepts JSON input containing a code field and executes the provided code in a Node.js vm.runInNewContext sandbox. This is fixed in version 0.2.1.

Weakness: CWE-78 (Improper Neutralization of Special Elements used in an OS Command), CWE-77 (Improper Neutralization of Special Elements used in a Command), CWE-352 (Cross-Site Request Forgery)

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

2 open source packages ship an affected version, including @nestjs/devtools-integration. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `@nestjs/devtools-integration` | npm | All versions | 0.2.1 |
| `@nestjs/devtools-integration` | npm | All versions | 0.2.1 |

Products: Nestjs Devtools-Integration.

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

Upgrade @nestjs/devtools-integration to 0.2.1 or later.

## Is CVE-2025-54782 being exploited?

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

Public exploit code:

- PoC for CVE-2025-54782 (github_poc): https://github.com/vxaretra/CVE-2025-54782
- CVE-2025-54782 (github_poc): https://github.com/DDestinys/CVE-2025-54782
- NestJS DevTools Integration - Remote Code Execution (nuclei): http/cves/2025/CVE-2025-54782.yaml

## Fix prompt for AI coding agents

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

What it is: CVE-2025-54782 is a critical code injection vulnerability in nestjs nest, published on 1 Aug 2025. It can only be exploited from the same machine or local network, with no action from the victim.
Exploitation: It is not confirmed as exploited in the wild, but public exploit code for CVE-2025-54782 exists.

Affected packages and fixed versions:
- @nestjs/devtools-integration (npm): affected all versions; fixed in 0.2.1
- @nestjs/devtools-integration (npm): affected all versions; fixed in 0.2.1

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-54782/ (Markdown: https://insights.sbomify.com/CVE-2025-54782/index.md)
```

## Sources

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

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