CVE-2025-31486
📋 TL;DR
This vulnerability in Vite allows attackers to bypass file access restrictions and read arbitrary files from the server. It affects Vite 6.0+ development servers that are explicitly exposed to the network. Only files smaller than the inline asset limit (default 4kB) can be accessed.
💻 Affected Systems
- Vite
⚠️ Manual Verification Required
This CVE does not have specific version information in our database, so automatic vulnerability detection cannot determine if your system is affected.
Why? The CVE database entry doesn't specify which versions are vulnerable (no version ranges provided by the vendor/NVD).
🔒 Custom verification scripts are available for registered users. Sign up free to download automated test scripts.
- Review the CVE details at NVD
- Check vendor security advisories for your specific version
- Test if the vulnerability is exploitable in your environment
- Consider updating to the latest version as a precaution
⚠️ Risk & Real-World Impact
Worst Case
Sensitive configuration files, environment variables, or source code could be exfiltrated from the development server.
Likely Case
Attackers could access development configuration files, API keys, or other sensitive data stored in small files.
If Mitigated
If development servers are not exposed to untrusted networks, the risk is minimal as local access would be required.
🎯 Exploit Status
Exploit involves appending ?.svg with ?.wasm?init or using sec-fetch-dest: script header to bypass restrictions.
🛠️ Fix & Mitigation
✅ Official Fix
Patch Version: 4.5.12, 5.4.17, 6.0.14, 6.1.4, 6.2.5
Vendor Advisory: https://github.com/vitejs/vite/security/advisories/GHSA-xcj6-pq6g-qj4x
Restart Required: Yes
Instructions:
1. Update Vite to a patched version using npm update vite or yarn upgrade vite. 2. Restart the development server. 3. Verify the version with vite --version.
🔧 Temporary Workarounds
Restrict Network Exposure
allDo not expose Vite development server to untrusted networks
Remove --host flag or server.host configuration
Increase Asset Size Limit
allIncrease build.assetsInlineLimit to make more files ineligible for inline processing
In vite.config.js: build: { assetsInlineLimit: 8192 }
🧯 If You Can't Patch
- Do not expose Vite development server to any network (use localhost only)
- Implement network-level restrictions to limit access to Vite dev server port
🔍 How to Verify
Check if Vulnerable:
Check if using Vite 6.0+ and dev 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 6.0.14, 6.1.4, 6.2.5 or higher
📡 Detection & Monitoring
Log Indicators:
- Unusual requests with ?.svg?wasm?init parameters
- Requests with sec-fetch-dest: script header to asset endpoints
Network Indicators:
- HTTP requests to Vite dev server port with unusual query parameters from external IPs
SIEM Query:
http.url:*?.svg?wasm?init OR http.headers:sec-fetch-dest:script AND destination.port:5173
🔗 References
- https://github.com/vitejs/vite/blob/037f801075ec35bb6e52145d659f71a23813c48f/packages/vite/src/node/plugins/asset.ts#L285-L290
- https://github.com/vitejs/vite/commit/62d7e81ee189d65899bb65f3263ddbd85247b647
- https://github.com/vitejs/vite/security/advisories/GHSA-xcj6-pq6g-qj4x
- https://github.com/vitejs/vite/security/advisories/GHSA-xcj6-pq6g-qj4x