CVE-2023-34092

7.5 HIGH

📋 TL;DR

This vulnerability allows unauthenticated attackers to bypass Vite's file system restrictions by using double forward-slashes (//) in URLs, potentially exposing sensitive files like .env and certificate files. Only affects users who explicitly expose their Vite development server to the network using --host or server.host configuration. The exposure is limited to files in the immediate Vite project root folder.

💻 Affected Systems

Products:
  • Vite
Versions: All versions before 2.9.16, 3.2.7, 4.0.5, 4.1.5, 4.2.3, and 4.3.9
Operating Systems: All
Default Config Vulnerable: ✅ No
Notes: Only vulnerable when Vite dev server is explicitly exposed to network using --host flag or server.host configuration option. Default configuration is not vulnerable.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Attackers could read sensitive configuration files (.env, .env.*), private keys (*.crt, *.pem), or other project files containing secrets, credentials, or sensitive data from the exposed Vite development server.

🟠

Likely Case

Exposure of development environment secrets, API keys, database credentials, or other sensitive configuration data stored in project root files.

🟢

If Mitigated

No impact if Vite dev server is not exposed to the network or if proper network segmentation and access controls are implemented.

🌐 Internet-Facing: HIGH
🏢 Internal Only: LOW

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ⚠️ Yes
Complexity: LOW

Exploitation is trivial - attackers can simply append double forward-slashes to URLs to bypass file restrictions. Proof of concept is available in the GitHub advisory.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: vite@4.3.9, vite@4.2.3, vite@4.1.5, vite@4.0.5, vite@3.2.7, vite@2.9.16

Vendor Advisory: https://github.com/vitejs/vite/security/advisories/GHSA-353f-5xf4-qw67

Restart Required: Yes

Instructions:

1. Update Vite to the patched version for your major release. 2. Run 'npm update vite' or 'yarn upgrade vite'. 3. Restart your development server. 4. Verify the fix by checking the version with 'vite --version'.

🔧 Temporary Workarounds

Disable network exposure

all

Do not expose Vite development server to the network by avoiding --host flag and server.host configuration

Remove '--host' flag from dev scripts
Set server.host: false in vite.config.js

Network restriction

linux

Restrict Vite dev server to localhost only using firewall rules

sudo ufw deny from any to any port 5173
sudo iptables -A INPUT -p tcp --dport 5173 -j DROP

🧯 If You Can't Patch

  • Do not expose Vite development server to any network (use localhost only)
  • Implement network-level access controls to restrict access to Vite dev server port (default 5173)

🔍 How to Verify

Check if Vulnerable:

Check if Vite version is below patched versions and if server is exposed with --host or server.host config

Check Version:

vite --version or check package.json for vite version

Verify Fix Applied:

Verify Vite version is at or above patched version and test that double-slash URLs no longer bypass file restrictions

📡 Detection & Monitoring

Log Indicators:

  • Unusual file access patterns with double forward-slashes in URLs
  • Access attempts to .env, .env.*, *.crt, *.pem files

Network Indicators:

  • HTTP requests containing '//' in paths to Vite dev server
  • External IPs accessing Vite dev server port

SIEM Query:

source="vite_logs" AND (url="*//*" OR path="*//*")

🔗 References

📤 Share & Export