CVE-2025-58752

5.3 MEDIUM

📋 TL;DR

This vulnerability in Vite allows unauthorized access to HTML files on the server regardless of filesystem restrictions when the dev server is exposed to the network. It affects applications using Vite's development or preview servers with default or MPA appType configurations. Only systems where the Vite server is explicitly made network-accessible are vulnerable.

💻 Affected Systems

Products:
  • Vite
Versions: All versions prior to 7.1.5, 7.0.7, 6.3.6, and 5.4.20
Operating Systems: All
Default Config Vulnerable: ✅ No
Notes: Only vulnerable when: 1) Vite dev server exposed to network (--host or server.host config), 2) Using appType: 'spa' (default) or 'mpa', 3) Also affects preview server

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Attackers could access sensitive HTML files containing credentials, configuration data, or proprietary information from anywhere on the server filesystem.

🟠

Likely Case

Unauthorized access to HTML files in directories outside the intended project scope, potentially exposing development files, configuration templates, or other web content.

🟢

If Mitigated

If server.fs restrictions are properly configured and network exposure is limited, impact is minimal to none.

🌐 Internet-Facing: HIGH
🏢 Internal Only: MEDIUM

🎯 Exploit Status

Public PoC: ✅ No
Weaponized: UNKNOWN
Unauthenticated Exploit: ⚠️ Yes
Complexity: LOW

Exploitation requires network access to the exposed Vite server and knowledge of file paths on the target system.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: 7.1.5, 7.0.7, 6.3.6, or 5.4.20

Vendor Advisory: https://github.com/vitejs/vite/security/advisories/GHSA-jqfw-vq24-v9c3

Restart Required: Yes

Instructions:

1. Update Vite to patched version: npm update vite@latest or specify exact version. 2. Restart development/preview servers. 3. Verify server.fs restrictions are properly configured.

🔧 Temporary Workarounds

Restrict Network Exposure

all

Do not expose Vite dev server to network using --host or server.host configuration

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

Configure Filesystem Restrictions

all

Explicitly configure server.fs.allow to restrict accessible directories

Add server.fs.allow: ['.'] to vite.config.js to restrict to current directory

🧯 If You Can't Patch

  • Do not expose Vite development or preview servers to untrusted networks
  • Implement network-level restrictions (firewall rules) to limit access to Vite server ports

🔍 How to Verify

Check if Vulnerable:

Check Vite version and configuration: 1. Run 'npm list vite' to check version. 2. Review vite.config.js for server.host settings. 3. Check if dev server is started with --host flag.

Check Version:

npm list vite | grep vite

Verify Fix Applied:

1. Confirm Vite version is 7.1.5, 7.0.7, 6.3.6, or 5.4.20 or higher. 2. Test that HTML files outside project directory are no longer accessible via the dev server.

📡 Detection & Monitoring

Log Indicators:

  • Unusual requests for HTML files outside project directory
  • Access to paths containing '..' or absolute paths

Network Indicators:

  • HTTP requests to Vite dev server ports (typically 5173, 3000) from unexpected sources
  • Requests for HTML files with unusual paths

SIEM Query:

source="vite-server" AND (path="*../*" OR path="/absolute/path/*") AND response_code=200

🔗 References

📤 Share & Export