GHSA-rq7h-c2jc-7f22

Suggest an improvement
Source
https://github.com/advisories/GHSA-rq7h-c2jc-7f22
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/10/GHSA-rq7h-c2jc-7f22/GHSA-rq7h-c2jc-7f22.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-rq7h-c2jc-7f22
Aliases
Published
2026-10-21T16:47:42Z
Modified
2026-10-21T17:00:06Z
Severity
  • 6.3 (Medium) CVSS_V4 - CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:L/VI:N/VA:N/SC:N/SI:N/SA:N CVSS Calculator
Summary
Vite: Files outside `server.fs.allow` could be served when project paths match system paths on non-Windows machine
Details

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
Database specific
{
    "cwe_ids":  [
        "CWE-22",
        "CWE-284"
    ],
    "github_reviewed":  true,
    "github_reviewed_at":  "2026-10-21T16:47:42Z",
    "nvd_published_at":  "2026-10-20T16:17:05Z",
    "severity":  "MODERATE"
}
References

Affected packages

npm
vite

Package

Affected ranges

Type
SEMVER
Events
Introduced
8.3.0
Fixed
8.3.3

Database specific

last_known_affected_version_range
"<= 8.3.2"
source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/10/GHSA-rq7h-c2jc-7f22/GHSA-rq7h-c2jc-7f22.json"
vite

Package

Affected ranges

Type
SEMVER
Events
Introduced
8.2.0
Fixed
8.2.4

Database specific

last_known_affected_version_range
"<= 8.2.3"
source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/10/GHSA-rq7h-c2jc-7f22/GHSA-rq7h-c2jc-7f22.json"
vite

Package

Affected ranges

Type
SEMVER
Events
Introduced
8.0.0
Fixed
8.1.6

Database specific

last_known_affected_version_range
"<= 8.1.5"
source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/10/GHSA-rq7h-c2jc-7f22/GHSA-rq7h-c2jc-7f22.json"
vite

Package

Affected ranges

Type
SEMVER
Events
Introduced
7.0.0
Fixed
7.3.7

Database specific

last_known_affected_version_range
"<= 7.3.6"
source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/10/GHSA-rq7h-c2jc-7f22/GHSA-rq7h-c2jc-7f22.json"
vite

Package

Affected ranges

Type
SEMVER
Events
Introduced
0 Unknown introduced version / All previous versions are affected
Fixed
6.4.4

Database specific

last_known_affected_version_range
"<= 6.4.3"
source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/10/GHSA-rq7h-c2jc-7f22/GHSA-rq7h-c2jc-7f22.json"
vite-plus

Package

Name
vite-plus
View open source insights on deps.dev
Purl
pkg:npm/vite-plus

Affected ranges

Type
SEMVER
Events
Introduced
0 Unknown introduced version / All previous versions are affected
Fixed
1.1.0

Database specific

last_known_affected_version_range
"<= 1.0.0"
source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/10/GHSA-rq7h-c2jc-7f22/GHSA-rq7h-c2jc-7f22.json"