High

Vite Vulnerable to Arbitrary File Read via Vite Dev Server WebSocket

  • Disclosed: 06.04.2026
  • Updated: 11.10.2026 10:22

Summary

server.fs check was not enforced to the fetchModule method that is exposed in Vite dev server's WebSocket.

Impact

Only apps that match the following conditions are affected:

  • explicitly exposes the Vite dev server to the network (using --host or server.host config option)
  • WebSocket is not disabled by server.ws: false

Arbitrary files on the server (development machine, CI environment, container, etc.) can be exposed.

Details

If it is possible to connect to the Vite dev server’s WebSocket without an Origin header, an attacker can invoke fetchModule via the custom WebSocket event vite:invoke and combine file://... with ?raw (or ?inline) to retrieve the contents of arbitrary files on the server as a JavaScript string (e.g., export default "...").

The access control enforced in the HTTP request path (such as server.fs.allow) is not applied to this WebSocket-based execution path.

PoC

  1. Start the dev server on the target Example (used during validation with this repository):

    bash
    pnpm -C playground/alias exec vite --host 0.0.0.0 --port 5173
  2. Confirm that access is blocked via the HTTP path (example: arbitrary file)

    bash
    curl -i 'http://localhost:5173/@fs/etc/passwd?raw'

    Result: 403 Restricted (outside the allow list) <img width="3898" height="1014" alt="image" src="https://github.com/user-attachments/assets/f6593377-549c-45d7-b562-5c19833438af" />

  3. Confirm that the same file can be retrieved via the WebSocket path By connecting to the HMR WebSocket without an Origin header and sending a vite:invoke request that calls fetchModule with a file://... URL and ?raw, the file contents are returned as a JavaScript module. <img width="1049" height="296" alt="image" src="https://github.com/user-attachments/assets/af969f7b-d34e-4af4-8adb-5e2b83b31972" /> <img width="1382" height="955" alt="image" src="https://github.com/user-attachments/assets/6a230d2e-197a-4c9c-b373-d0129756d5d7" />

Affected software

Click a technology to see all vulnerabilities affecting it.

PlatformPackageVulnerable versionsFixed in
npm package vite >= 8.0.0, < 8.0.5, >= 7.0.0, < 7.3.2, >= 6.0.0, < 6.4.2 8.0.5, 7.3.2, 6.4.2

References

CVSS score -
CVSS vector
CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N
Weakness (CWE)
CWE-200, CWE-306
Platform
npm
Package
vite
Disclosed
06.04.2026
Updated
11.10.2026 10:22

Sources and licenses

OSV / GitHub Advisory Database - GHSA-p9ff-h696-f583 - CC BY 4.0

Vulnerability history: vite

All published vulnerabilities of this package (npm package), newest first. Shows whether this is a one-off slip or a package that needs watching.

All (24) in the archive
Total entries
24
First → latest
08.2022 10.2026
Without a fix
0
Exploited in attacks
1

Severity breakdown

  • High 8
  • Medium 14
  • Low 2

Disclosures per year

  1. 2022: 1
  2. 2023: 2
  3. 2024: 4
  4. 2025: 9
  5. 2026: 8
Severity:
  1. High CVE-2026-112942 >= 8.3.0, < 8.3.3, >= 8.2.0, < 8.2.4, >= 8.0.0, < 8.1.6, >= 7.0.0, < 7.3.7, < 6.4.4 8.3.3, 8.2.4, 8.1.6, 7.3.7, 6.4.4
  2. High · 7.5 CVE-2026-53571 >= 8.0.0, < 8.0.16, >= 7.0.0, < 7.3.5, < 6.4.3 8.0.16, 7.3.5, 6.4.3
  3. High CVE-2026-39364 >= 8.0.0, < 8.0.5, >= 7.1.0, < 7.3.2 8.0.5, 7.3.2
  4. Vite Vulnerable to Arbitrary File Read via Vite Dev Server WebSocket this entry
    High CVE-2026-39363 >= 8.0.0, < 8.0.5, >= 7.0.0, < 7.3.2, >= 6.0.0, < 6.4.2 8.0.5, 7.3.2, 6.4.2
  5. High · 7.5 CVE-2024-23331 >= 2.7.0, < 2.9.17, >= 3.0.0, < 3.2.8, >= 4.0.0, < 4.5.2, >= 5.0.0, < 5.0.12 2.9.17, 3.2.8, 4.5.2, 5.0.12
  6. High · 7.5 CVE-2023-34092 < 2.9.16, >= 3.0.2, < 3.2.7, >= 4.0.0, < 4.0.5, >= 4.1.0, < 4.1.5, >= 4.2.0, < 4.2.3, >= 4.3.0, < 4.3.9 2.9.16, 3.2.7, 4.0.5, 4.1.5, 4.2.3, 4.3.9
  7. High · 8.6 CVE-2022-35204 < 2.9.13, >= 3.0.0-alpha.0, < 3.0.0-beta.4 2.9.13, 3.0.0-beta.4

Know which vulnerabilities affect your application

With the DockRay integration and software inventory enabled, DockRay checks reported component versions against known vulnerabilities and notifies you about confirmed matches. Coverage depends on the supported technology and available advisory data.

Connect your application
DockRay newsletter

Application security in your inbox

Important vulnerabilities, actionable guidance and practical advice for your applications. Choose your technologies and follow what matters to your project.

  • A daily digest of new vulnerabilities, critical ones included.
  • Notifications about important updates.
  • Practical advice on application security and monitoring.

Leave empty to receive updates for every technology.

Free to subscribe. Unsubscribe with one click in any email.