Vite: `server.fs.deny` bypassed with queries
Affected releases · vite
- 6.x6.4.4Fixed in 6.4.5
On 6.x, the newest line:
npm install vite@6.4.5Every release on a timeline
Not affected
8.0.0 – 8.3.8
39 releases, latest
Not affected
6.0.0 – 6.4.3
43 releases
Affected
6.4.4
1 release
Fixed
6.4.5 – 6.4.6
2 releases
What happens
Summary
The contents of files that are specified by server.fs.deny can be returned to the browser. This is the same as github.com/vitejs/vite/security/advisories/GHSA….
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.allowthe sensitive file is denied with a pattern that matches a file by
server.fs.deny
Details
On the Vite dev server, files that should be blocked by server.fs.deny (e.g., .env, *.crt) can be retrieved with HTTP 200 responses when query parameters such as ?raw, ?import&raw, or ?import&url&inline are appended.
For the fix for github.com/vitejs/vite/security/advisories/GHSA…, v6.4.4 back-ported #20410. But while that PR requires #22160 for github.com/vitejs/vite/security/advisories/GHSA…, #22160 wasn't back-ported together causing v6 vulnerable to github.com/vitejs/vite/security/advisories/GHSA….
A whole project to check? Paste its package.json in the dependency check: every deprecated, outdated or vulnerable dependency, with what to upgrade to. Free, no account.