Skip to content
Critical Vite RCE (CVSS 9.1): Remote Code Execution via Exposed Dev Servers

Critical Vite RCE (CVSS 9.1): Remote Code Execution via Exposed Dev Servers

Vite's development server contains a critical RCE vulnerability (CVSS 9.1, GHSA-p4f5-76q4-ffq7) affecting versions 4.x–8.x, allowing unauthenticated attackers to execute arbitrary code and read sensitive files when the dev server is exposed to untrusted networks via --host 0.0.0.0, Docker, or cloud tunnels; fixed in versions 8.3.7, 8.2.5, 8.1.7, 7.3.8, 6.4.6, and Vite+ 1.5.1.

IT Services Circle
IT Services Circle
IT Services Circle

Vulnerability Overview

On November 18, the Vite team published a security advisory urging developers to upgrade immediately to address a critical remote code execution (RCE) vulnerability in the development server. The vulnerability is tracked as GHSA-p4f5-76q4-ffq7 and carries a CVSS 4.0 score of 9.1 (Critical). It was publicly disclosed on November 10 and affects Vite versions 4.x through 8.x.

An attacker who can send malicious HTTP requests to an exposed Vite dev server can achieve arbitrary file read and remote code execution without authentication or any user interaction.

Severity and Impact

The advisory identifies two primary risks:

Arbitrary file read : Bypasses Vite's server.fs file access restrictions to read files that should be inaccessible, such as .env files, API keys, and access tokens.

Remote code execution (RCE) : Exploits Vite's internal code evaluation mechanisms to execute arbitrary JavaScript on the development server process.

Once the dev server is compromised, an attacker can steal sensitive credentials and potentially take control of the host process. Critically, the attack requires no login and does not rely on the developer executing malicious code.

Root Cause

The flaw originates in Vite's module resolution logic. Two special virtual modules — __vite-browser-external and __vite-optional-peer-dep — embed module IDs from the URL directly into generated JavaScript without proper escaping. This improper output encoding ( CWE-116 ) allows an attacker to inject malicious code into these virtual modules.

The injected code can then bypass file access controls or leverage new Worker, import.meta.glob, and eval pathways to achieve server-side code execution.

Exploit Conditions

Exploitation requires the Vite dev server to be explicitly exposed to the network. Common scenarios include:

Running vite --host 0.0.0.0 Configuring server: { host: '0.0.0.0' } in vite.config.ts Docker deployments that map the dev port

VPS or cloud servers running the dev server

LAN debugging with --host Public tunnels exposing the dev port

Shared cloud development environments

Default dev servers listening only on localhost are not affected. Production builds created with vite build are also unaffected.

Affected and Fixed Versions

The following table summarizes the vulnerable ranges and their corresponding patched versions:

8.3.0 – 8.3.6 → fixed in 8.3.7

8.2.0 – 8.2.4 → fixed in 8.2.5

8.0.0 – 8.1.6 → fixed in 8.1.7

7.0.0 – 7.3.7 → fixed in 7.3.8

4.0.0 – 6.4.5 → fixed in 6.4.6

Vite+ ≤ 1.5.0 → fixed in 1.5.1

Note that Vite 4.x and 5.x do not receive dedicated patches; users must upgrade to a newer major version that includes the fix (e.g., 6.4.6 or later).

Remediation Steps

Check current version : Run npm ls vite to identify the installed version.

Upgrade to the patched version matching your major version line, for example:

# Vite 8.3.x
npm install -D [email protected]

# Vite 7.x
npm install -D [email protected]

# Vite 6.x
npm install -D [email protected]

Update lockfiles to ensure all team members and CI environments install the secure version.

Restart the development server ; running processes will not automatically load the patch.

Audit network exposure : Remove unnecessary --host flags or server.host configuration, and restrict dev server access to trusted networks only.

If the dev server was exposed to untrusted networks for an extended period, review access logs and rotate any potentially compromised credentials (API keys, tokens, etc.).

Official Reference

Full advisory:

https://github.com/vitejs/vite/security/advisories/GHSA-p4f5-76q4-ffq7
Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

securityvulnerabilityRCEVitedev serverCVSS 9.1arbitrary file readCWE-116
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.