[beta only] files otuside `server.fs.allow` and not included in `server.fs.deny` can be served by two requests using `?worker`
Summary
[!IMPORTANT]
This advisory only affects beta versions.
Summary
With 8.4.0-beta.1, the contents of files that are outside server.fs.allow and not included in [server.fs.deny](https://vite.dev/config/server-options#server...
Affected packages
| Package | Affected → Fixed | |
|---|---|---|
| npmvite |
8.4.0-beta.1→ 8.4.0-beta.2 |
8.4.0-beta.2 |
Original description The description as published by the source.
[!IMPORTANT]
This advisory only affects beta versions.
Summary
With 8.4.0-beta.1, the contents of files that are outside server.fs.allow and not included in server.fs.deny can be returned to the browser.
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 is not specified by server.fs.deny
- Uses v8.4.0-beta.1
Details
In 8.4.0-beta.1, a dev server can be made to serve any file outside server.fs.allow that is not matched by server.fs.deny, with two unauthenticated GET requests and no preconditions:
GET /@fs/?worker&import. The worker plugin generates aWorkerWrappermodule whose body embeds the request-chosen path, and in doing so registers the absolute path inconfig.environments.client.safeModulePaths.GET /@fs/200 with the file content. The safeModulePaths check short-circuits before thefs.allowcheck.
Only server.fs.deny matches keep working after registration. ?sharedworker&import triggers the same flow, and ?wasm / ?init&import / ?source&import queries register .wasm files the same way.
This is new in 8.4. The poisoning write (`fil…
Source: GitHub Repository Security Advisories (Game のスタック) GitHub Advisory OSV
References
- GITHUB_REPO_ADVISORY vitejs/vite