/

CVE-2026-39363

Severity:

HIGH RISK

(7.5)

Information Disclosure in Vite Dev Server Module Fetching

CVE-2026-39363

Modified

Vulnerability type

Category:

Information Disclosure

CWE:

CWE-200, CWE-306, CWE-1220

Impact:

Arbitrary File Read on the Development Server

Severity:

HIGH RISK

(7.5)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

Vite's development server exposes a WebSocket endpoint that can be abused to fetch arbitrary local files as JavaScript strings when Origin checks are missing or bypassed.

If an attacker can connect to the dev server's WebSocket without a valid Origin header, they may invoke internal module-fetching logic and read files from the server's filesystem outside the normal HTTP access controls.

Affected context

This vulnerability affects Vite dev server deployments running affected versions where:

  • The Vite dev server is reachable from an attacker's environment (e.g., exposed to a broader network or internet-facing during development).
  • WebSocket connections to the dev server can be established without a strict Origin header check.
  • The internal vite:invoke WebSocket event and fetchModule pathway are available during development.

In such setups, the WebSocket-based file loading path is not subject to the same filesystem access controls enforced on HTTP requests.

Exploit preconditions

  • Attack surface: Vite dev server's WebSocket endpoint used for development tooling.
  • Required access: Network-level ability to reach the dev server and open a WebSocket connection (e.g., from the same LAN, VPN, or internet if misconfigured).
  • Authentication / Origin checks: Ability to connect without a restrictive Origin header, or in an environment where Origin validation is absent, misconfigured, or bypassed.
  • Trigger point: Sending a crafted vite:invoke WebSocket message that calls fetchModule with a file://... URL combined with ?raw or ?inline.
  • Why exploitation is possible: The WebSocket-based module fetch logic bypasses the HTTP-layer access control (such as server.fs.allow) and treats attacker-controlled file paths as trusted module input, returning file contents as JavaScript strings.

Why this happens

The root cause lies in a mismatch between security controls on different code paths that access the filesystem.

Vite enforces filesystem restrictions on HTTP requests (for example, using server.fs.allow) but failed to apply equivalent checks to the WebSocket-driven fetchModule pathway.

Because the WebSocket handler trusted connections that lacked a validated Origin header, it exposed internal functionality (vite:invoke) that could be steered to load arbitrary local resources via file:// URLs with special query parameters (?raw or ?inline).

This design issue maps to CWE-200: Exposure of Sensitive Information to an Unauthorized Actor due to unintended data disclosure, and relates to CWE-306: Missing Authentication for Critical Function because a privileged file-access capability was reachable without appropriate access control when invoked over WebSocket.

Potential impact

  • Disclosure of arbitrary local files readable by the dev server process, including configuration files or code not normally exposed over HTTP.
  • Exposure of secrets stored in local files, such as API keys, tokens, or environment-specific credentials.
  • Leakage of application source code or proprietary logic from the developer's machine or build environment.
  • Increased risk of follow-on attacks, such as credential reuse or targeted exploitation based on revealed configuration details.

General mitigation guidance

Effective mitigation focuses on tightening trust boundaries around the dev server and aligning security checks across all access paths:

  • Restrict dev server exposure to trusted networks only (e.g., bind to localhost or development VPN) so untrusted clients cannot reach the WebSocket endpoint.
  • Enforce strict Origin validation and, where applicable, additional authentication or tokens for dev tooling WebSocket connections.
  • Harmonize access control logic so that any file access—whether via HTTP or WebSocket—passes through the same authorization and filesystem-allowlist checks.
  • Minimize secrets and sensitive assets on machines running the dev server, or store them outside paths accessible to development tooling.
  • Apply least-privilege filesystem practices for development environments, ensuring the dev process does not needlessly have read access to sensitive directories.

How teams detect issues like this

Detection can leverage both code-centric and environment-centric approaches:

  • Static analysis / code review:
  • Look for WebSocket handlers that expose internal commands (such as vite:invoke-style RPC) without consistent access control or Origin validation.
  • Flag code paths that open or fetch local files (file:// or filesystem APIs) without passing through a common authorization layer.
  • Identify logic that treats dev-only APIs as implicitly trusted without environmental checks (e.g., assuming all clients are local).
  • Runtime and configuration monitoring:
  • Monitor dev server logs for unusual WebSocket connections from unexpected IPs or with missing/abnormal Origin headers.
  • Track use of internal invocation events that resemble module-fetching commands originating from non-standard clients.
  • Use network policies or local firewalls to detect and alert on external access attempts to dev server ports.
  • Automated tooling:
  • Incorporate SAST/DAST tools that understand WebSocket flows and can verify that critical operations require appropriate authentication and are subject to the same access checks as HTTP endpoints.

Sources

SourceLink
github.comgithub.com/vitejs/vite/security/advisories/GHSA-p9ff-h696-f583
access.redhat.comaccess.redhat.com/errata/RHSA-2026:24761
access.redhat.comaccess.redhat.com/errata/RHSA-2026:24762
access.redhat.comaccess.redhat.com/errata/RHSA-2026:24866
access.redhat.comaccess.redhat.com/security/cve/CVE-2026-39363
bugzilla.redhat.combugzilla.redhat.com/show_bug.cgi?id=2456179
security.access.redhat.comsecurity.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-39363.json

Frequently asked

questions

It can be, but only if the Vite dev server is reachable from the internet or an untrusted network segment and accepts WebSocket connections without strict Origin checks. In more locked-down setups (e.g., bound to localhost), the practical attack surface is limited to local or same-host attackers.

The attacker needs network-level access to the Vite dev server port and the ability to establish a WebSocket connection that is treated as trusted by the server (for example, no enforced Origin validation or additional authentication).

The most robust pattern is to ensure that any functionality capable of accessing local files or executing privileged dev tooling operations is consistently protected across all entry points, including WebSockets. This means applying the same filesystem-allowlist checks, Origin validation, and where appropriate authentication, to dev tooling endpoints that can read from the host.

Design dev and admin interfaces under a "never implicitly trusted" model: centralize authorization and filesystem access control, enforce Origin and authentication checks on all interactive channels (HTTP, WebSocket, RPC), restrict network exposure of dev servers, and include these patterns in code review and security testing so that new access paths cannot bypass established controls.

Find out what's already
exploitable in your codebase.