The Vite Dev Server CVE: When “Just Local” Isn't
In September 2026, a vulnerability in Vite's dev server (CVE-2026-39364) was being actively exploited. Attackers were mass-scanning for exposed dev servers and pulling .env files — with cloud credentials inside — straight off disk.
I've run vite --host more times than I'd like to admit, because "it's just local dev." It's local right up until your laptop is on a network someone is scanning, or that "temporary" preview box on a cloud VM is still running three weeks later.
What the bug was
Vite's dev server has a deny list, server.fs.deny, that is meant to stop it from serving sensitive files such as .env and certificates. CVE-2026-39364 was a bypass: by appending certain query parameters (like ?raw or ?import&raw) to a request, an attacker could get those "denied" files back with a normal 200 OK.
On its own, that only matters if someone can reach your dev server. That's the key condition: the server has to be listening on a network interface, which is exactly what --host (or server.host) does.
The fix landed in Vite 7.3.2 and 8.0.5 (with backports to some older lines). Check the official advisory for your exact version.
What the attackers were doing
This wasn't a theoretical proof of concept. Security researchers reported a scanning campaign that:
- Probed for
.env,/root/.envand/proc/self/environ - Looked for AWS and Azure credentials, Terraform state and serverless config
- Used encoded path traversal and disguised itself with crawler-style user agents
In other words: automated, opportunistic, and aimed at exactly the files developers assume never leave their machine.
Am I exposed?
Run through this quickly:
- Which Vite version are you on? Run
npm ls vite. If it's older than the patched release for your major version, upgrade. - Do you ever use
--host? Check yourpackage.jsonscripts andvite.configforhost: trueorhost: "0.0.0.0". - Have you ever run a dev server on a cloud VM, container or shared box? Those IP ranges are what got scanned.
- What's in your
.env? If a dev server was exposed and the file held real keys, rotate them. Upgrading doesn't un-leak a secret.
Production builds aren't affected by this particular bug. vite build outputs static files and doesn't ship the dev server. The risk is dev servers left reachable.
The habits I'm changing
Bind to localhost by default
Only expose the dev server on the network when you actually need to (testing on a phone, for example), and turn it off afterwards. Make --host a deliberate, separate script rather than the default:
{
"scripts": {
"dev": "vite",
"dev:lan": "vite --host"
}
}Keep production secrets out of local .env files
Your dev environment should run on dev keys: test-mode payment keys, a dev database, sandbox API tokens. If a local .env leaks, the blast radius should be "rotate a sandbox key," not "rotate production AWS."
Never use a dev server as a preview environment
If you need to share work, deploy a preview build (Netlify and Vercel deploy previews are made for this). A preview build serves static files. A dev server serves your filesystem.
Treat dev tooling as part of your attack surface
We put a lot of care into production boundaries: auth checks, webhook signature verification, strict input validation. Dev tooling gets none of that because it "doesn't count." This CVE is a reminder that anything listening on a port counts.
The takeaway
Convenient defaults are a gift during development and a liability the moment they meet a network. Patch Vite, keep your dev server on localhost, keep real secrets out of local env files, and rotate anything that might have been exposed.
Want help auditing a frontend project's tooling and secrets setup? Let's talk.
Sources: Cloud Security Alliance research note · Cybersecurity News: exposed Vite servers under attack · OpenCVE: CVE-2026-39364