# CVE-2025-58751: Vite middleware may serve files starting with the same name with the public directory

> Attackers can read sensitive files bypassing security settings if the Vite dev server is exposed to the network with specific symlink configurations.

- **Severity:** Low 2.3 (`CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N`)
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** A user has to click or open something
- **Fix available:** Yes
- **Published:** 8 Sep 2025
- **Updated:** 9 Sep 2025
- **Also known as:** GHSA-g4jq-h2w9-997c, MINI-7q3h-rxjg-mhqw, MINI-8c4r-xw62-v98q, MINI-jxgx-8qr2-q92w, ROOT-APP-NPM-CVE-2025-58751

## What is CVE-2025-58751?

CVE-2025-58751 is a low-severity path traversal vulnerability in vitejs vite, published on 8 Sep 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. Prior to versions 7.1.5, 7.0.7, 6.3.6, and 5.4.20, files starting with the same name with the public directory were served bypassing the `server.fs` settings. Only apps that explicitly expose the Vite dev server to the network (using --host or `server.host` config option), use the public directory feature (enabled by default), and have a symlink in the public directory are affected. Versions 7.1.5, 7.0.7, 6.3.6, and 5.4.20 fix the issue.

Weakness: CWE-284 (Improper Access Control), CWE-22 (Improper Limitation of a Pathname to a Restricted Directory), CWE-200 (Exposure of Sensitive Information to an Unauthorized Actor)

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

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


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `vite` | npm | All versions | 5.4.20 |
| `vite` | npm | All versions | 5.4.20 |
| `vite` | npm | From 6.0.0 | 6.3.6 |
| `vite` | npm | From 6.0.0 | 6.3.6 |
| `vite` | npm | From 7.0.0 | 7.0.7 |
| `vite` | npm | From 7.0.0 | 7.0.7 |
| `vite` | npm | From 7.1.0 | 7.1.5 |
| `vite` | npm | From 7.1.0 | 7.1.5 |

Products: Vitejs Vite.

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

Upgrade vite to a fixed version for your release line: 5.4.20, 6.3.6, 7.0.7 or 7.1.5.

## Is CVE-2025-58751 being exploited?

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

Public exploit code:

- Vite Dev Server - Path Traversal (nuclei): http/cves/2025/CVE-2025-58751.yaml

## Other vulnerabilities in vitejs vite

- [CVE-2025-31125](https://insights.sbomify.com/CVE-2025-31125/): Vite Vitejs Improper Access Control (medium 5.3, exploited in the wild)
- [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)

## Fix prompt for AI coding agents

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

What it is: CVE-2025-58751 is a low-severity path traversal vulnerability in vitejs vite, published on 8 Sep 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: It is not confirmed as exploited in the wild, but public exploit code for CVE-2025-58751 exists.

Affected packages and fixed versions:
- vite (npm): affected all versions; fixed in 5.4.20
- vite (npm): affected all versions; fixed in 5.4.20
- vite (npm): affected from 6.0.0; fixed in 6.3.6
- vite (npm): affected from 6.0.0; fixed in 6.3.6
- vite (npm): affected from 7.0.0; fixed in 7.0.7
- vite (npm): affected from 7.0.0; fixed in 7.0.7
- vite (npm): affected from 7.1.0; fixed in 7.1.5
- vite (npm): affected from 7.1.0; fixed in 7.1.5

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

## Sources

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

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