Packages / vite / Security

ModerateVulnerabilityGHSA-rq7h-c2jc-7f22CVE-2026-112946Published 21 Oct 2026

Vite: Files outside `server.fs.allow` could be served when project paths match system paths on non-Windows machine

Affected releases · vite

  • 8.x8.0.0 – 8.3.2Fixed in 8.3.3
  • 7.x7.0.0 – 7.3.6Fixed in 7.3.7
  • 6.x6.0.0 – 6.4.3Fixed in 6.4.4
  • 5.x and older0.1.0 – 5.4.21No fix, no longer updated

On 8.x, the newest line:

npm install vite@8.3.3
8.x
  1. Affected

    8.0.0 – 8.1.5

    23 releases

  2. Fixed

    8.1.6

    1 release

  3. Affected

    8.2.0 – 8.2.2

    3 releases

  4. Fixed

    8.2.4

    1 release

  5. Affected

    8.3.0 – 8.3.2

    3 releases

  6. Fixed

    8.3.3 – 8.3.5

    3 releases, latest

7.x
  1. Affected

    7.0.0 – 7.3.6

    35 releases

  2. Fixed

    7.3.7

    1 release

6.x
  1. Affected

    6.0.0 – 6.4.3

    43 releases

  2. Fixed

    6.4.4 – 6.4.5

    2 releases

5.x
  1. Affected

    5.0.0 – 5.4.21

    67 releases

4.x
  1. Affected

    4.0.0 – 4.5.14

    53 releases

3.x
  1. Affected

    3.0.0 – 3.2.11

    30 releases

2.x
  1. Affected

    2.0.0 – 2.9.18

    97 releases

0.x
  1. Affected

    0.1.0 – 0.20.10

    78 releases

440 stable releases of vite, oldest to newest, one row per major.

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.

What happens

Summary

The content of files outside server.fs setting can be returned to the browser if the project imports a file path concatenated with the root. For example, if the project references <path-to-project-root>/etc/hosts, the content of /etc/hosts was possible to be returned.

The content of files outside the server.fs.allow option can be returned to the browser when a project imports a file whose root-relative path matches an absolute path on the host. For example, referencing <project-root>/etc/hosts could make Vite return the host's /etc/hosts file.

Impact

Only apps that meet all of the following conditions are affected:

  • explicitly expose the Vite dev server to the network (using --host or the server.host option)

  • contain an imported file whose root-relative browser URL is also the absolute path of a readable file on the host

  • The sensitive file is not matched by server.fs.deny

  • the dev server is not running on Windows

Details

When Vite analyzes an in-root import, it rewrites the resolved module ID to a browser URL such as /etc/hostname. In affected versions, Vite converts that URL with fsPathFromUrl and adds the result to safeModulePaths. Because fsPathFromUrl ensures a leading slash without resolving the URL against the project root, the project URL /etc/hostname is recorded as if it were the absolute filesystem path /etc/hostname.

For a later request to /@fs/etc/hostname, the raw-filesystem middleware interprets /etc/hostname as an absolute path. The access check applies server.fs.deny, then accepts paths present in safeModulePaths before checking server.fs.allow. As a result, the request can return the host file instead of the project file that originally populated safeModulePaths.

PoC

The following example requires Linux with a readable /etc/hostname:

$ mkdir vite-safe-module-path-poc
$ cd vite-safe-module-path-poc
$ npm init -y
$ npm install vite@8.3.1
$ mkdir -p etc
$ echo 'PROJECT-DECOY\n' > etc/hostname
$ echo 'import "./etc/hostname"\n' > main.js
$ npx vite --host 127.0.0.1

In another terminal:

$ curl -o /dev/null -s -w '%{http_code}\n' http://127.0.0.1:5173/main.js
200
$ curl -sS -o response -w '%{http_code}\n' http://127.0.0.1:5173/@fs/etc/hostname
200
$ cmp -s response /etc/hostname && echo 'response matches host file'
response matches host file