# CVE-2025-31486: Vite allows server.fs.deny to be bypassed with .svg or relative paths

> Attackers can bypass file access restrictions to read arbitrary 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:** 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:** 3 Apr 2025
- **Updated:** 3 Apr 2025
- **Also known as:** CLSA-2026-1791666893, GHSA-xcj6-pq6g-qj4x, MINI-qw4g-pxqc-7pgp

## What is CVE-2025-31486?

CVE-2025-31486 is a medium-severity path traversal vulnerability in vitejs vite, published on 3 Apr 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. The contents of arbitrary files can be returned to the browser. By adding ?.svg with ?.wasm?init or with sec-fetch-dest: script header, the server.fs.deny restriction was able to bypass. This bypass is only possible if the file is smaller than build.assetsInlineLimit (default: 4kB) and when using Vite 6.0+. 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 4.5.12, 5.4.17, 6.0.14, 6.1.4, and 6.2.5.

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

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

10 open source packages ship an affected version, including vite.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `vite` | npm | All versions | 4.5.12 |
| `vite` | npm | All versions | 4.5.12 |
| `vite` | npm | From 5.0.0 | 5.4.17 |
| `vite` | npm | From 5.0.0 | 5.4.17 |
| `vite` | npm | From 6.0.0 | 6.0.14 |
| `vite` | npm | From 6.0.0 | 6.0.14 |
| `vite` | npm | From 6.1.0 | 6.1.4 |
| `vite` | npm | From 6.1.0 | 6.1.4 |
| `vite` | npm | From 6.2.0 | 6.2.5 |
| `vite` | npm | From 6.2.0 | 6.2.5 |

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

Upgrade vite to a fixed version for your release line: 4.5.12, 5.4.17, 6.0.14 or 6.1.4.

## Is CVE-2025-31486 being exploited?

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

Public exploit code:

- Vite任意文件读取漏洞批量检测脚本CVE-2025-31486 (github_poc): https://github.com/iSee857/CVE-2025-31486-PoC
- CVE-2025-31486 poc (github_poc): https://github.com/ll104567/CVE-2025-31486
- https://github.com/hackmelocal/CVE-2025-31486-Simulation (github_poc): https://github.com/hackmelocal/CVE-2025-31486-Simulation
- Vite server.fs.deny Bypass - Local File Inclusion (nuclei): http/cves/2025/CVE-2025-31486.yaml

## Fix prompt for AI coding agents

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

What it is: CVE-2025-31486 is a medium-severity path traversal vulnerability in vitejs vite, published on 3 Apr 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-31486 exists.

Affected packages and fixed versions:
- vite (npm): affected all versions; fixed in 4.5.12
- vite (npm): affected all versions; fixed in 4.5.12
- vite (npm): affected from 5.0.0; fixed in 5.4.17
- vite (npm): affected from 5.0.0; fixed in 5.4.17
- vite (npm): affected from 6.0.0; fixed in 6.0.14
- vite (npm): affected from 6.0.0; fixed in 6.0.14
- vite (npm): affected from 6.1.0; fixed in 6.1.4
- vite (npm): affected from 6.1.0; fixed in 6.1.4
- vite (npm): affected from 6.2.0; fixed in 6.2.5
- vite (npm): affected from 6.2.0; fixed in 6.2.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-31486/ (Markdown: https://insights.sbomify.com/CVE-2025-31486/index.md)
```

## Sources

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

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