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.
- 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
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.
Which versions are affected by CVE-2025-31486?
10 open source packages ship an affected version, including vite.
| Package | 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 |
4 more packages
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.
Upgrade, and resolve every user-supplied path against an allowed base folder before opening it. More about Path traversal.
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: 1 Nuclei template and 3 proofs of concept on GitHub.
Sources
Also known as CLSA-2026-1791666893, GHSA-xcj6-pq6g-qj4x, MINI-qw4g-pxqc-7pgp.