/

CVE-2026-39364

Severity:

HIGH RISK

(7.5)

Improper Access Control in Vite Dev Server Static File

CVE-2026-39364

Modified

Vulnerability type

Category:

Improper Access Control

CWE:

CWE-180, CWE-284, CWE-472

Impact:

Sensitive Information Disclosure

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 improperly enforces filesystem deny rules, allowing access to sensitive files such as .env and certificate files when specific query parameters are appended to the URL.

An attacker who can reach the dev server over HTTP may retrieve configuration secrets or other protected files by abusing parameters like ?raw, ?import&raw, or ?import&url&inline, even though these files are configured to be blocked.

Affected context

This vulnerability appears in Vite projects using the dev server with server.fs.deny configured to block sensitive paths (e.g., .env, *.crt, or other restricted files).

It manifests when the dev server is reachable from a browser and users or tools request static files with transformation-oriented query parameters like ?raw, ?import&raw, or ?import&url&inline.

It is most relevant where the dev server is exposed beyond a tightly controlled local developer machine (e.g., shared dev environments, remote tunnels, or misconfigured production-like setups).

Exploit preconditions

  • Attack surface: HTTP interface of the Vite dev server.
  • Required access: Network access to the dev server (e.g., via localhost with browser malware, shared network, remote dev URLs, or port forwarding).
  • Configuration context: Sensitive files exist within or reachable from the dev server's root, and are intended to be blocked via server.fs.deny.
  • Trigger point: An HTTP GET request to a denied file path with query parameters such as ?raw, ?import&raw, or ?import&url&inline.
  • Why exploitation is possible: The access-control logic that enforces server.fs.deny does not correctly apply when certain resource transformation query parameters are present, allowing blocked files to be served with HTTP 200 responses.

Why this happens

The core issue is an improper enforcement of access control on filesystem resources when request URLs include particular query parameters.

The dev server likely evaluates deny rules on a normalized path or route form but fails to reapply or consistently enforce those rules when the request is handled by code paths responsible for special resource modes (e.g., raw, url, or inline imports).

This maps to CWE-284: Improper Access Control, where the intended authorization policy (block sensitive files via server.fs.deny) is not reliably enforced across all request variants.

The involvement of query parameters also aligns with CWE-180: Incorrect Behavior Order, as the sequence of normalization, access checks, and transformation routing allows a bypass: transformation logic is applied before or instead of a complete deny check, causing sensitive resources to be treated as regular transformable assets.

Potential impact

  • Disclosure of environment configuration files (e.g., .env) that may contain API keys, database credentials, and other secrets.
  • Exposure of TLS certificate and key material (e.g., *.crt and related files) if stored within the served tree.
  • Leakage of internal configuration, debug files, or other sensitive assets assumed to be protected by server.fs.deny.
  • Facilitation of further attacks such as account takeover, lateral movement, or compromise of backing services using recovered credentials.
  • Unintentional exposure of secrets in shared or cloud-based development environments where the dev server is reachable by other tenants or over the internet.

General mitigation guidance

Mitigation generally focuses on tightening access control around the dev server and separating sensitive data from the served filesystem:

  • Avoid placing secrets or private keys in directories that the dev server can serve; keep .env and certificates outside the web root and load them via OS-level environment variables or separate configuration channels.
  • Restrict dev server network exposure: bind to loopback by default, avoid exposing it directly on public interfaces, and gate remote access through authenticated tunnels or VPNs.
  • Apply defense-in-depth controls such as HTTP-level access restrictions (IP allowlists, reverse proxies, or authentication) when dev tooling must be reachable remotely.
  • Treat query parameters that alter file handling (raw, url, inline, etc.) as untrusted input and ensure deny checks are applied to the underlying resource before any transformation logic.
  • Use least-privilege principles for file access: configure the dev process so it only has read access to files actually required for development, not to arbitrary secrets on the filesystem.

How teams detect issues like this

Effective detection combines automated checks with targeted review of server configuration and routing logic:

  • Static analysis / code scanning: Flag code paths where filesystem access occurs after routing based on query parameters, particularly where deny or allow rules are not revalidated on the final resolved resource.
  • Configuration review: Inspect server.fs.deny and related settings to ensure sensitive paths are not only listed but also excluded from any special file-handling plugins or middleware.
  • Security testing: Use automated or manual HTTP testing to request known blocked files (.env, certificates, private config) with combinations of transformation parameters (?raw, ?import&raw, ?import&url&inline) and verify that they consistently return an error status instead of 200.
  • Policy enforcement in CI: Incorporate checks that prevent secrets from being committed into directories served by development tooling, using secret scanners and repository policies.
  • Observability: Where feasible, log and monitor access to sensitive paths on dev servers (including requests with suspicious query parameters) to catch abnormal patterns indicative of probing or exploitation.

Sources

SourceLink
github.comgithub.com/vitejs/vite/security/advisories/GHSA-v2wj-q39q-566r
access.redhat.comaccess.redhat.com/errata/RHSA-2026:24866
access.redhat.comaccess.redhat.com/security/cve/CVE-2026-39364
bugzilla.redhat.combugzilla.redhat.com/show_bug.cgi?id=2456181
security.access.redhat.comsecurity.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-39364.json

Frequently asked

questions

It can be, depending on how the dev server is exposed. If the Vite dev server is reachable from other machines (e.g., via a LAN, cloud dev environment, remote tunnel, or misconfigured public endpoint), a remote attacker may exploit this issue. When the server is strictly bound to localhost and not proxied or shared, the risk is largely limited to threats on the local system (such as malicious browser extensions or local malware).

The attacker only needs network access to the Vite dev server's HTTP port. No authentication or prior access to the project files is required, assuming the server is accessible and the targeted sensitive files are within its reachable filesystem scope.

The safest pattern is to ensure that sensitive assets are never served or even reachable through dev tooling. Store secrets outside the served directory, load them via secure configuration mechanisms, and apply access control or network restrictions so that dev servers are not exposed beyond trusted environments. Additionally, ensure that any deny rules or access checks are enforced uniformly, regardless of query parameters or transformation modes.

Prevention hinges on designing dev and build servers with strict, centralized access-control enforcement that runs on the final resolved resource path before any special handling. Development teams can adopt secure defaults (localhost binding, no secrets in served trees), integrate automated configuration and secret scanning into CI, and include tests specifically aimed at bypassing deny rules using alternate routes, query parameters, or transformation flags.

Find out what's already
exploitable in your codebase.