vite: `server.fs.deny` bypass on Windows alternate paths
Affected releases · vite
- 8.x8.0.0 – 8.0.15Fixed in 8.0.16
- 7.x7.0.0 – 7.3.3Fixed in 7.3.5
- 6.x6.0.0 – 6.4.2Fixed in 6.4.3
- 5.x and older0.1.0 – 5.4.21No fix, no longer updated
On 8.x, the newest line:
npm install vite@8.0.16Affected
8.0.0 – 8.0.15
16 releases
Fixed
8.0.16 – 8.3.4
17 releases, latest
Affected
7.0.0 – 7.3.3
33 releases
Fixed
7.3.5 – 7.3.7
3 releases
Affected
6.0.0 – 6.4.2
42 releases
Fixed
6.4.3 – 6.4.4
2 releases
Affected
5.0.0 – 5.4.21
67 releases
Affected
4.0.0 – 4.5.14
53 releases
Affected
3.0.0 – 3.2.11
30 releases
Affected
2.0.0 – 2.9.18
97 releases
Affected
0.1.0 – 0.20.10
78 releases
Affected releases · vite-plus
- 0.1.x0.1.0 – 0.1.23Fixed in 0.1.24
- 0.0.x0.0.1No fix on this line yet
On 0.1.x, the newest line:
npm install vite-plus@0.1.24Not affected
1.0.0 – 1.3.0
4 releases, latest
Affected
0.0.1 – 0.1.23
25 releases
Fixed
0.1.24 – 0.3.3
15 releases
Is your project affected?
Paste your package.json, or type the range you declare for vite. It is read in your browser and sent nowhere.
Is your project affected?
Paste your package.json, or type the range you declare for vite-plus. It is read in your browser and sent nowhere.
What happens
Summary
The contents of files that are specified by server.fs.deny can be returned to the browser on Windows.
Impact
Only apps that match the following conditions are affected:
explicitly exposes the Vite dev server to the network (using
--hostorserver.hostconfig option)the sensitive file exists in the allowed directories specified by
server.fs.alloweither of:
the sensitive file exists in an NTFS volume
the dev server is running on Windows and the sensitive file exists in a volume that 8.3 short name generation is enabled (it is enabled by default on system volumes)
Details
Vite’s dev server denies direct access to sensitive files through server.fs.deny, including entries such as .env, .env.*, and *.{crt,pem}. However, on Windows, the deny logic does not correctly normalize NTFS ADS path forms before access checks are applied.
Because of this, requests such as /.env::$DATA?raw are treated as allowed paths, while Windows resolves them to the original file's default data stream.
Similar to that, Windows allows accessing a file using a different name with the 8.3 short name compatibility feature. Vite did not reject accessing files via them.
PoC
$ npm create vite@latest $ cd vite-project/ $ npm install $ npm run dev
Access via browser at http://localhost:5173/.env::$DATA?raw
Example expected result:
/.env::$DATA?rawreturns the contents of.env/tls.pem::$DATA?rawreturns the contents oftls.pem