CVE-2025-30208 PoC and fix: the Vite dev server file read that exposes .env files

CVE-2025-30208 lets anyone who can reach a Vite dev server read files outside the project's allow list, .env included, with a crafted query string. It affects Vite before 6.2.3, 6.1.2, 6.0.12, 5.4.15 and 4.5.10, and only dev servers exposed to the network. The proof of concept is public. Upgrade Vite, and never serve production with vite or npm run dev: build the app and serve the built files.

The team behind Keybrum's attacksUpdated 8 min read
CVE-2025-30208medium · CVSS 5.3
Component
Vite dev server (server.fs allow and deny lists) (vite)
Affected
Vite before 4.5.10, 5.0.0 to 5.4.14, 6.0.0 to 6.0.11, 6.1.0 to 6.1.1 and 6.2.0 to 6.2.2, only when the dev server is exposed to the network
Fixed in
6.2.3, 6.1.2, 6.0.12, 5.4.15, 4.5.10. Latest on 15 November 2026: 8.3.8, 7.3.8, 6.4.6
Published
March 24, 2025
Does it reach a version you install? Drop your lockfile in the dependency checker: it reads every package, this one included.

In short

  • A Vite dev server refuses to serve files outside its allow list and files on its deny list, such as .env. With a crafted query string, affected versions returned them anyway: source code, keys, any file the server process can read.
  • Only dev servers exposed to the network are affected: started with --host or with server.host set. A dev server on localhost is out of reach, and an app built with vite build has no dev server at all.
  • Fixed in Vite 6.2.3, 6.1.2, 6.0.12, 5.4.15 and 4.5.10, all published on 24 March 2025. Four more bypasses of the same protection followed within six weeks, so those versions are not a safe place to stop.
  • The proof of concept is in the advisory itself. A sibling flaw, CVE-2025-31125, is in CISA's Known Exploited Vulnerabilities catalog since 22 January 2026.
  • The real fix is to stop serving production from a dev server. Upgrading closes this bypass; it does not make npm run dev a production server.
On this page

What CVE-2025-30208 is, in plain words

Vite is a build tool for React, Vue and Svelte apps. In development it runs a dev server: a small web server that compiles your files on request and reloads the page when you save. To do that it can read files straight from your disk through special addresses.

Two settings keep that from turning into a hole. server.fs.allow limits which folders the dev server may serve, your project by default. server.fs.deny is a block list of sensitive files inside those folders: the Vite docs list .env, .env.*, certificate and key files and the .git folder among the defaults. A request for anything else gets a 403.

CVE-2025-30208 is a way around both. The advisory explains that extra separator characters at the end of the query string were removed in some places of the code and not accounted for in the checks, so a request with a crafted query string passed the check and got the file. Its summary is one sentence: the contents of arbitrary files can be returned to the browser.

What a stranger can do with it

Where the dev server runsWhat anyone who can reach it can read
A server or container where npm run dev is the production commandThe project's .env with its database password and API keys, the full source code, and other files the process can read on that machine
A cloud development machine or a preview with a public addressThe same, plus whatever credentials sit in that environment
A laptop started with --host on an office, hotel or conference networkProject files and files in the home folder, for anyone on the same network
A laptop on the default localhostNothing through this CVE: the advisory limits it to servers exposed to the network
An app built with vite build and served as static filesNothing: there is no dev server in production
The flaw reads files. It does not write them or run code.

Severity, proof of concept and exploitation status

Two scores exist and they disagree. GitHub, the numbering authority for the Vite maintainers, gives 5.3, medium (AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:N/A:N): it counts the exposure of the dev server as a hurdle. NVD gives 7.5, high (AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N): once the server is reachable, one request with no login is enough. Use the higher one if your dev server faces the internet.

Who is affected

The advisory is precise: only apps explicitly exposing the Vite dev server to the network, using --host or the server.host config option. By default Vite listens on localhost only. Set to 0.0.0.0 or true, it listens on every address of the machine, public ones included.

Release lineAffectedFirst fixed version
6.26.2.0 to 6.2.26.2.3
6.16.1.0 to 6.1.16.1.2
6.06.0.0 to 6.0.116.0.12
5.x5.0.0 to 5.4.145.4.15
4.x and olderEverything before 4.5.104.5.10
Ranges from GitHub advisory GHSA-x574-m823-4x7w. Vite 7 and 8 were released after the fix and are not in the range.

One case sits outside the advisory's wording and inside its logic. A tunnel or a reverse proxy on the same machine that forwards a public address to the dev server exposes it just as well as --host does, because the request arrives from the machine itself.

Apps built with AI tools

Older Lovable apps are React with Vite, and Bolt projects commonly use Vite too. When such an app is built and published as static files, this CVE has nothing to reach. The exposed case appears when the project leaves the builder: someone asks an agent to put it on a VPS, and the quickest thing that works is a Dockerfile or a process manager that runs npm run dev -- --host. The site loads, so nobody looks again. The Lovable security guide and the Bolt security guide cover what else changes when you leave the platform.

How to check your own app

Three questions: which version, how production starts, and what your live site actually serves.

bash
# 1. Installed version: use the line for your package manager
npm ls vite
pnpm why vite
yarn why vite

# 2. How production starts. A dev command here is the problem
grep -n '"dev"\|"start"\|"preview"' package.json
grep -n -i 'CMD\|ENTRYPOINT' Dockerfile
grep -rn 'host' vite.config.*

# 3. On the server: is a dev server running right now?
ps aux | grep -i '[v]ite'
A dev server prints its addresses at startup. A Network: line with a public address means it is exposed.

Then look at your live site from outside. Open the page source: a script tag that loads /@vite/client means a dev server is serving your production app. The same check from a terminal, against your own domain only:

bash
# Replace with your own domain. A built app answers 404 or your app shell.
# A dev server answers with the Vite hot-reload client, a JavaScript file.
curl -s https://your-app.example/@vite/client | head -c 300
This asks for a file Vite hands to every visitor of a dev server. It reads nothing private.

Keybrum proves the condition this CVE needs, not the file read itself. On apps whose owner proved ownership, the attack web.dev-server-exposed asks for the Vite client when your page loads it, then for the entry module the page names. If the answer is the real Vite hot-reload client, the finding states that a development server runs as the live app. It never requests a file outside the project, so it does not send the request of CVE-2025-30208. The version check above settles that part. Keybrum also checks whether /.env is served as a plain file: see the exposed env file guide.

How to fix CVE-2025-30208

Two fixes, and you need both: a current Vite, and a production setup with no dev server in it.

  1. 1

    Upgrade Vite

    The first fixed versions are 6.2.3, 6.1.2, 6.0.12, 5.4.15 and 4.5.10. Do not stop there: go to the latest release of a line that still gets fixes. On 15 November 2026 npm lists 8.3.8 as latest, 7.3.8 for the 7.x line and 6.4.6 for 6.x.

  2. 2

    Build for production

    Run vite build and serve the dist folder with a static host, nginx or your platform's static hosting. A built app is plain files: there is no dev server to ask for anything.

  3. 3

    Take the dev server off the network

    Remove --host from your scripts and server.host from vite.config, unless you need to test from a phone. If you do need it, do it on a network you trust and stop the server afterwards.

  4. 4

    Close the port

    On a server, block the dev port (5173 by default) in the firewall. Nothing outside the machine should reach it.

bash
# Upgrade
npm install vite@latest

# Production: build once, serve the files
npm run build
# dist/ now holds the app. Serve it with your static host or nginx.
If your framework runs its own server on top of Vite, use its production command, not its dev command.

What to do after upgrading

The version that fixes this CVE is the first of a series. Researchers kept finding new ways around the same protection.

CVEPublishedFirst fixed versions
CVE-2025-30208 (this page)March 20256.2.3, 6.1.2, 6.0.12, 5.4.15, 4.5.10
CVE-2025-31125, in CISA's exploited catalogMarch 20256.2.4, 6.1.3, 6.0.13, 5.4.16, 4.5.11
CVE-2025-31486April 20256.2.5, 6.1.4, 6.0.14, 5.4.17, 4.5.12
CVE-2025-32395April 20256.2.6, 6.1.5, 6.0.15, 5.4.18, 4.5.13
CVE-2025-46565April 20256.3.4, 6.2.7, 6.1.6, 5.4.19, 4.5.14
From the GitHub Advisory Database. More server.fs bypasses were published in 2026, and their advisories list fixed versions for Vite 6.4, 7 and 8 only.

That last line is the trap: Vite 4 and 5 got the fix for this CVE, but the 2026 advisories give no fixed version on those lines. A project pinned to 5.4 is patched for CVE-2025-30208 and open to later bypasses.

If a dev server was exposed, also assume its .env was read. Rotate every key in it, starting with the ones that cost money or open your database: our guide on what to do with a leaked key gives the order. Then move secrets out of files on the server, as the secrets management guide describes.

Timeline

DateEvent
18 March 2025CVE ID reserved by GitHub
24 March 2025Vite 6.2.3, 6.1.2, 6.0.12, 5.4.15 and 4.5.10 published. CVE record and NVD entry published. CISA's assessment: proof of concept available
25 March 2025Advisory GHSA-x574-m823-4x7w added to the GitHub Advisory Database
31 March to 30 April 2025Four more bypasses of the same protection: CVE-2025-31125, CVE-2025-31486, CVE-2025-32395, CVE-2025-46565
22 January 2026CISA adds CVE-2025-31125 to its Known Exploited Vulnerabilities catalog
13 November 2026CVE-2025-30208 itself is still absent from that catalog

Questions

Is there a public PoC for CVE-2025-30208?

Yes. The GitHub advisory itself contains a proof of concept, and CISA recorded one on 24 March 2025. This page does not repeat it. To know whether you are exposed, check your Vite version and whether a dev server answers on your live domain.

Am I affected if I only run Vite on localhost?

Not by this CVE. The advisory limits it to dev servers explicitly exposed to the network with --host or server.host. Upgrade anyway: a later flaw, or a tunnel you start one day, changes the answer.

Is my production app affected if it was built with vite build?

No. vite build produces static files, and the flaw is in the dev server. You are affected only if production itself runs vite or npm run dev, which you can check by looking for /@vite/client in the page source of your live site.

Which Vite version fixes CVE-2025-30208?

6.2.3, 6.1.2, 6.0.12, 5.4.15 and 4.5.10, depending on your release line. Four related bypasses were fixed in the following weeks and more in 2026, so move to the latest 6.4, 7 or 8 release instead of the first fixed version.

Has CVE-2025-30208 been exploited in the wild?

It is not in CISA's Known Exploited Vulnerabilities catalog as of 13 November 2026. Its sibling CVE-2025-31125 is, since 22 January 2026, and the EPSS score of CVE-2025-30208 was 74.8% on 15 November 2026. Assume exposed dev servers get scanned.

Can an attacker read my .env file through this flaw?

Yes, on an exposed dev server running an affected version. .env is on Vite's default deny list, and the flaw bypasses that list. Rotate every key in the file if this was your case.

Sources

  1. 1.GHSA-x574-m823-4x7w: Vite bypasses server.fs.deny, Vite on GitHub
  2. 2.CVE-2025-30208, NIST National Vulnerability Database
  3. 3.CVE-2025-30208, CVE Program
  4. 4.GitHub advisory database: GHSA-x574-m823-4x7w, GitHub
  5. 5.Server options: server.host, server.fs.allow, server.fs.deny, Vite Docs
  6. 6.GHSA-4r4m-qw57-chr8 (CVE-2025-31125), GitHub
  7. 7.GHSA-xcj6-pq6g-qj4x (CVE-2025-31486), GitHub
  8. 8.GHSA-356w-63v5-8wf4 (CVE-2025-32395), GitHub
  9. 9.GHSA-859w-5945-r5v3 (CVE-2025-46565), GitHub
  10. 10.Known Exploited Vulnerabilities Catalog (CVE-2025-31125 added 22 January 2026), CISA
  11. 11.EPSS score for CVE-2025-30208, FIRST
  12. 12.vite versions, npm

Your app is public. So are its mistakes.

Check what any attacker can already see in it, free, in ten seconds. The full attack, with proof and fixes: €49 once, or €29 a month on a plan.

or continue with Google or GitHub