# CVE-2025-31125: Vite Vitejs Improper Access Control

> Attackers can bypass file access restrictions to read sensitive files if the Vite dev server is exposed to the network.

- **Severity:** Medium 5.3 (`CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:N/A:N`)
- **Exploited in the wild:** Yes, since 22 Jan 2026 (CISA KEV)
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 31 Mar 2025
- **Updated:** 23 Jan 2026
- **Also known as:** GHSA-4r4m-qw57-chr8, MINI-qj5j-42h3-7rfg

## What is CVE-2025-31125?

CVE-2025-31125 is a medium-severity path traversal vulnerability in vitejs vite, published on 31 Mar 2025. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

### Official description

Vite is a frontend tooling framework for javascript. Vite exposes content of non-allowed files using ?inline&import or ?raw?import. Only apps explicitly exposing the Vite dev server to the network (using --host or server.host config option) are affected. This vulnerability is fixed in 6.2.4, 6.1.3, 6.0.13, 5.4.16, and 4.5.11.

Weakness: CWE-284 (Improper Access Control), CWE-200 (Exposure of Sensitive Information to an Unauthorized Actor)

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

10 open source packages ship an affected version, including vite. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `vite` | npm | All versions | 4.5.11 |
| `vite` | npm | All versions | 4.5.11 |
| `vite` | npm | From 5.0.0 | 5.4.16 |
| `vite` | npm | From 5.0.0 | 5.4.16 |
| `vite` | npm | From 6.0.0 | 6.0.13 |
| `vite` | npm | From 6.0.0 | 6.0.13 |
| `vite` | npm | From 6.1.0 | 6.1.3 |
| `vite` | npm | From 6.1.0 | 6.1.3 |
| `vite` | npm | From 6.2.0 | 6.2.4 |
| `vite` | npm | From 6.2.0 | 6.2.4 |

Products: Vitejs Vite.

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

Upgrade vite to a fixed version for your release line: 4.5.11, 5.4.16, 6.0.13 or 6.1.3. US federal agencies must fix it by 12 Feb 2026.

## Is CVE-2025-31125 being exploited?

Yes. Attackers have exploited CVE-2025-31125 in the wild since at least 22 Jan 2026.

Public exploit code:

- Vite 任意文件读取漏洞POC (github_poc): https://github.com/sunhuiHi666/CVE-2025-31125
-  Vite Development Server's @fs endpoint (CVE-2025-31125) to access sensitive files like /etc/passwd and /etc/hosts via crafted URLs. (github_poc): https://github.com/MuhammadWaseem29/Vitejs-exploit
- Vite WASM Import Path Traversal 🛡️ (github_poc): https://github.com/0xgh057r3c0n/CVE-2025-31125
- Vite is a frontend tooling framework for javascript. Vite exposes content of non-allowed files using ?inline&import or ?raw?import. Only apps explicitly exposing the Vite dev server to the network (using --host or server.host config option) are affected. This vulnerability is fixed in 6.2.4, 6.1.3, 6.0.13, 5.4.16, and 4.5.11. (github_poc): https://github.com/harshgupptaa/Path-Transversal-CVE-2025-31125-
- Vite Development Server - Path Traversal (nuclei): http/cves/2025/CVE-2025-31125.yaml

## Other vulnerabilities in vitejs vite

- [CVE-2026-53571](https://insights.sbomify.com/CVE-2026-53571/): Vite: `server.fs.deny` bypass on Windows alternate paths (high 8.2)
- [CVE-2026-39363](https://insights.sbomify.com/CVE-2026-39363/): Vite Affected by Arbitrary File Read via Vite Dev Server WebSocket (high 8.2)
- [CVE-2026-39364](https://insights.sbomify.com/CVE-2026-39364/): Vite has a `server.fs.deny` bypass with queries (high 8.2)
- [CVE-2024-23331](https://insights.sbomify.com/CVE-2024-23331/): Vite dev server option `server.fs.deny` can be bypassed when hosted on case-insensitive filesystem (high 7.5)
- [CVE-2023-34092](https://insights.sbomify.com/CVE-2023-34092/): Vite Server Options (server.fs.deny) can be bypassed using double forward-slash (//) (high 7.5)

## Fix prompt for AI coding agents

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

What it is: CVE-2025-31125 is a medium-severity path traversal vulnerability in vitejs vite, published on 31 Mar 2025. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Exploitation: Yes. Attackers have exploited CVE-2025-31125 in the wild since at least 22 Jan 2026.

Affected packages and fixed versions:
- vite (npm): affected all versions; fixed in 4.5.11
- vite (npm): affected all versions; fixed in 4.5.11
- vite (npm): affected from 5.0.0; fixed in 5.4.16
- vite (npm): affected from 5.0.0; fixed in 5.4.16
- vite (npm): affected from 6.0.0; fixed in 6.0.13
- vite (npm): affected from 6.0.0; fixed in 6.0.13
- vite (npm): affected from 6.1.0; fixed in 6.1.3
- vite (npm): affected from 6.1.0; fixed in 6.1.3
- vite (npm): affected from 6.2.0; fixed in 6.2.4
- vite (npm): affected from 6.2.0; fixed in 6.2.4

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

## Sources

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

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