VibeCPR

← All fixes

Security · Vite · Dev server · Lovable

Is my Vite dev server exposed? Check --host / server.host and patch the RCE (GHSA-p4f5-76q4-ffq7)

Updated (first published ) · Last verified · Applies to: Vite, Lovable, Bolt, Cursor, Claude Code, Replit, v0, Docker

TL;DR fix: GitHub advisory GHSA-p4f5-76q4-ffq7 (Critical, published Nov 10, 2026): a crafted HTTP request to the Vite dev server can read files outside your project and run code on your machine. Only dev servers exposed to the network are affected, meaning --host or server.host (true, 0.0.0.0, "::"), a published Docker port, or a cloud VM. Affected: vite 4.0.0 to 6.4.5, 7.0.0 to 7.3.7, 8.0.0 to 8.1.6, 8.2.0 to 8.2.4, 8.3.0 to 8.3.6. Fix: upgrade to 8.3.8 (or 8.2.6, 8.1.7, 7.3.8, 6.4.6; 4.x and 5.x have no patch, so move to 6.4.6+), bind the dev server to 127.0.0.1, and never serve production with vite / npm run dev / vite preview. Exported Lovable projects listen on "::" (all interfaces) by default and the ones we checked use affected versions. npm audit printed "found 0 vulnerabilities" for an affected version in our test today.

Steps

  1. Check which vite version is installed. In the project folder run npm ls vite --all (or npx vite --version). Affected: 4.0.0–6.4.5, 7.0.0–7.3.7, 8.0.0–8.1.6, 8.2.0–8.2.4, 8.3.0–8.3.6. Don't rely on npm audit; in our test it reported 0 vulnerabilities for an affected version.
  2. Check whether the dev server is exposed. Start npm run dev and read Vite's banner: 'Network: use --host to expose' means localhost only; a 'Network: http://192.168…' line means it listens on your LAN or public interfaces. Confirm with ss -ltn (Linux) or lsof -nP -iTCP -sTCP:LISTEN (macOS): 127.0.0.1 or [::1] is local; *, 0.0.0.0 or [::] is exposed.
  3. Look for --host, server.host, Docker -p and cloud VMs. Search package.json scripts, vite.config.*, Dockerfile and docker-compose files for --host, host: true, '0.0.0.0' or '::', and -p 5173:5173 style port publishing. Lovable exports set host '::' in vite.config.ts or inside @lovable.dev/vite-tanstack-config.
  4. Check that production isn't a dev server. curl -s -o /dev/null -w '%{http_code} %{content_type}' https://your-app/@vite/client. 200 text/javascript means your live site is running the Vite dev server; fix the start command to serve the vite build output.
  5. Upgrade vite. npm install -D [email protected] (or the patched release on your line: 8.2.6, 8.1.7, 7.3.8, 6.4.6). vite-plus users: 1.5.1 or later. 4.x and 5.x have no patched release; move to 6.4.6 or newer. Exact pins like "vite": "8.1.5" don't move with npm update; change the version.
  6. Stop exposing the dev server. Set server.host to '127.0.0.1' (or remove --host). If you need it in Docker or on a VM, publish the port on 127.0.0.1 only (-p 127.0.0.1:5173:5173) and reach it through an SSH tunnel or a private network, never a public IP or 0.0.0.0.
  7. If it was exposed on an affected version, treat the machine as possibly compromised. Rotate secrets that the dev server's user could read (.env files, cloud and database keys, SSH keys, npm and GitHub tokens) and check the machine for unknown processes, cron jobs and changed files. If it was a shared or production server, get help.

The bug: your dev server is a server, and it might be on the internet

npm run dev starts the Vite dev server, a convenience server that compiles your code on demand. It was never meant to face strangers. On Nov 10, 2026 Vite published a Critical advisory, GHSA-p4f5-76q4-ffq7: by sending one crafted HTTP request to the dev server, an attacker could read files outside your project and get code run on the machine. The advisory explains the mechanism (an unescaped module ID in the __vite-browser-external virtual module that reaches Vite’s internal eval). We are not reproducing the exploit here, and you don’t need it to check yourself.

The advisory’s own scope is the important part: only apps that explicitly expose the dev server to the network, using --host or the server.host option, are affected. The catch is how often AI builders and templates do exactly that:

  • Lovable exports listen on all interfaces. Older exports have server: { host: "::", port: 8080 } in vite.config.ts with vite ^5.4.x. Newer TanStack-based exports have no host in vite.config.ts, but the @lovable.dev/vite-tanstack-config package (v2.27.2) sets host: "::" and port 8080 when it runs outside Lovable’s sandbox, and 18 of 20 recent exports we sampled pin "vite": "8.1.5". Both versions are affected. (We read public repos and the package code. Lovable’s docs don’t cover this.)
  • “It doesn’t work in Docker” gets fixed with --host, and a published Docker port binds to every host address by default. Docker’s port publishing docs say “Publishing container ports is insecure by default”.
  • Cloud VMs and “just run it on the server”: an AI agent that deploys with npm run dev puts the dev server on a public IP.
  • Coffee-shop, coworking and office Wi-Fi: exposed on your LAN means anyone on that network can reach it.

A static build on Vercel, Netlify or Cloudflare Pages doesn’t run the dev server, so your live site is fine unless its start command runs vite, npm run dev or vite preview.

Step 1: the 2-minute check

1. Which vite is installed? Run this in the project folder:

npm ls vite --all          # every copy, including ones pulled in by other tools
npx vite --version         # e.g. "vite/8.1.5 linux-x64 node-v22..."

Or let Node compare it to the advisory’s ranges:

node -e 'const v=require("vite/package.json").version,[a,b,c]=v.split(/[.-]/).map(Number),ok=a>8||a==8&&(b>3||b==3&&c>=7||b==2&&c>=5||b==1&&c>=7)||a==7&&(b>3||b==3&&c>=8)||a==6&&(b>4||b==4&&c>=6);console.log("vite",v,ok?"OK: patched for GHSA-p4f5-76q4-ffq7":"VULNERABLE: upgrade (8.3.8 / 8.2.6 / 8.1.7 / 7.3.8 / 6.4.6)")'

(pnpm: pnpm why vite; yarn: yarn why vite.) Don’t trust npm audit for this one. In our tests on Nov 19 and Nov 30, 2026 it printed found 0 vulnerabilities for vite 8.3.6, which is affected. The advisory lives on Vite’s GitHub repo, and GitHub’s global advisory database, which npm audit reads, still returned 404 for it on Nov 30.

2. Is the dev server exposed? Start it and read the banner:

  ➜  Local:   http://localhost:5173/
  ➜  Network: use --host to expose          <- local only

  ➜  Local:   http://localhost:5173/
  ➜  Network: http://192.168.1.23:5173/     <- exposed to your network

Then confirm what it’s actually listening on, while it runs:

ss -ltn | grep 5173                         # Linux (Lovable: grep 8080)
lsof -nP -iTCP -sTCP:LISTEN | grep node     # macOS

127.0.0.1:5173 or [::1]:5173 is local only. *:5173, 0.0.0.0:5173 or [::]:5173 is listening on every interface. From a second device on the same network, curl http://<your-ip>:5173/ should fail.

3. Find what turns it on:

grep -rnE -- '--host|host:\s*(true|"0\.0\.0\.0"|'"'"'0\.0\.0\.0'"'"'|"::"|'"'"'::'"'"')|vite-tanstack-config|-p [0-9]+:5173|"5173:5173"|"8080:8080"' \
  package.json vite.config.* Dockerfile* docker-compose* compose.y*ml 2>/dev/null

4. Is production a dev server?

curl -s -o /dev/null -w '%{http_code} %{content_type}\n' https://your-app.com/@vite/client

200 text/javascript means the live site is a Vite dev server: urgent. 404, or 200 text/html (your SPA’s fallback page), is normal for a built site.

What you seeCauseFix
vite in an affected range, banner says Network: use --host to exposeVulnerable version, but not exposedUpgrade anyway (Step 2); the next --host makes it live
Network: http://192.168… / *:8080 on a Lovable exporthost: "::" in vite.config.ts or the Lovable config packageStep 2 + Step 3
npm audit clean, npm ls vite shows 8.1.5Advisory isn’t in npm audit’s database (in our test)Compare versions by hand, upgrade
Pinned "vite": "8.1.5" stays put after npm updateExact pins don’t movenpm install -D -E [email protected] or newer
vite 5.4.x, no 5.x fix exists4.x/5.x weren’t patchedMove to 6.4.6+ (ideally 8.3.8)
Docker -p 5173:5173 + --hostPublished on all host addressesPublish on 127.0.0.1:5173:5173
Live site answers /@vite/client with JavaScriptProduction runs vite / npm run devStep 4
vite preview in productionNot a production server; inherits server.hostStep 4

Step 2: upgrade vite

npm install -D [email protected]        # or newer; 8.4.0 is latest on Nov 30, 2026
# staying on your line? 8.2.6, 8.1.7, 7.3.8 or 6.4.6
# vite-plus: 1.5.1 or later
npm ls vite --all                # confirm every copy moved
npm run build                    # make sure the build still works
  • The advisory lists 8.2.5, but 8.2.5 was never published to npm. The 8.2 fix is 8.2.6.
  • No patched 4.x or 5.x release exists (the latest 5.x, 5.4.21, predates the advisory). Older Lovable exports on ^5.4.x need a major upgrade. Try 6.4.6 first if 8 breaks plugins (e.g. @vitejs/plugin-react-swc), then 8.3.8.
  • Exact pins don’t move. In our test a project pinned to "vite": "8.1.5" stayed on 8.1.5 after npm update vite. npm install -D -E [email protected] moved it, and the build still worked.
  • Commit the lockfile so CI and teammates get the fixed version.

Step 3: stop exposing the dev server

Bind it to loopback explicitly. That also overrides the Lovable config package’s "::" default, because your settings are merged on top of it (from reading its code; we didn’t run the Lovable package itself):

// vite.config.ts (plain Vite)
export default defineConfig({
  server: { host: "127.0.0.1" },
});

// Lovable TanStack template: pass it through the vite option
export default defineConfig({
  vite: { server: { host: "127.0.0.1" } },
  // ...keep the existing tanstackStart options
});

and remove --host from package.json scripts. In our test, host: "127.0.0.1" listened on 127.0.0.1:5173 only and stopped answering on the machine’s network IP.

Need it reachable from another device or a container?

  • Docker: keep --host inside the container (it has to listen on the container’s interface), but publish the port to loopback only: docker run -p 127.0.0.1:5173:5173 ... or "127.0.0.1:5173:5173" in compose. Docker’s docs say that makes it reachable only from the Docker host (with a warning that on Docker releases older than 28.0.0, hosts on the same network segment could still reach localhost-published ports, so update Docker too).
  • Cloud VM / remote box: don’t open the port in the firewall. Use an SSH tunnel (ssh -L 5173:127.0.0.1:5173 you@server) or a private network/VPN.
  • Phone testing on your LAN: only on a trusted network, only on a patched vite, and turn it off afterwards. Keep server.allowedHosts an explicit list. Vite’s docs warn that allowedHosts: true enables DNS rebinding attacks.

Step 4: production must not be a dev server

Vite’s CLI docs say of vite preview: “Do not use this as a production server”. Also, preview.host defaults to server.host, so server.host: true exposes preview too (we confirmed this in our test). For a React/Vite SPA:

  1. Build: npm run build (outputs dist/).
  2. Serve dist/ from a static host (Vercel, Netlify, Cloudflare Pages) or a real web server. If deep links 404, see 404 on refresh.
  3. On a VM or in Docker, the container’s start command should serve dist/ (nginx, Caddy, or your Node server’s static middleware), not run npm run dev.
  4. Re-run the /@vite/client check against the live URL.

Never put secrets in VITE_ variables either; they end up in the browser bundle. See find and fix leaked API keys.

Step 5: if it was exposed on an affected version

The advisory describes reading files outside the project and running code as the dev server’s user, so assume the worst for the window it was reachable:

  1. Upgrade and close the exposure first (Steps 2–3).
  2. Rotate what that user could read: .env* files (Supabase service_role/secret keys, Stripe keys, OpenAI and other API keys), ~/.ssh, ~/.npmrc, GitHub/Git credentials, and cloud CLI credentials (~/.aws, ~/.config/gcloud). If the Supabase key changed, see Invalid API key after rotating keys.
  3. Look for persistence: unknown processes, new cron jobs or systemd units, startup items, changed shell profiles, unfamiliar SSH authorized_keys entries.
  4. For a cloud VM or shared server, rebuilding from a clean image is usually faster and safer than proving it’s clean.

Paste this into Lovable, Bolt, Replit, Cursor or Claude Code

Check this project for the Vite dev-server RCE GHSA-p4f5-76q4-ffq7. Do not
write or run any exploit code. Report findings first, then make changes:
1. Show the installed vite version(s) (npm ls vite --all). Affected:
   4.0.0-6.4.5, 7.0.0-7.3.7, 8.0.0-8.1.6, 8.2.0-8.2.4, 8.3.0-8.3.6.
   Do not rely on npm audit for this advisory.
2. Upgrade vite to 8.3.8 (or 8.2.6 / 8.1.7 / 7.3.8 / 6.4.6 if a plugin
   needs it; vite 4/5 must move to 6.4.6+). Update exact pins, the
   lockfile, and any vite-plus to 1.5.1+. Run the build and fix breakage.
3. Find every place the dev server is exposed: --host in package.json,
   server.host (true, "0.0.0.0", "::") in vite.config.*, the Lovable
   vite-tanstack-config default, Docker -p / compose ports. Set the dev
   server to host "127.0.0.1" and publish Docker ports on 127.0.0.1 only.
4. Make sure production never runs vite, npm run dev or vite preview: it
   must serve the built dist/ folder. Show me the start command.
5. List the secrets in .env files that I should rotate if the dev server
   was ever reachable from another machine. Don't print their values.

What we verified

  • Tested locally (Nov 19, 2026, Node 22, research/vite-test/, no exploit requests sent):
    • vite 8.3.6 with no host option listened on [::1]:5173 only, said Network: use --host to expose, and didn’t answer on the machine’s network IP.
    • With --host, server.host: true and server.host: "::", it listened on *:5173 and answered 200 on the network IP.
    • vite preview with server.host: true in the config also listened on all interfaces. server.host: "127.0.0.1" listened on loopback only and stopped answering on the network IP.
    • /@vite/client returned 200 text/javascript from the dev server, 200 text/html (SPA fallback) from vite preview, and 404 from our own static site.
    • npm ls vite, npx vite --version and the Node one-liner agreed for 8.3.6, 8.3.8 and 5.4.21, and the one-liner’s logic matched the advisory ranges for 18 sample versions.
    • npm audit printed found 0 vulnerabilities for affected vite 8.3.6.
    • An exact 8.1.5 pin survived npm update vite; npm install -D -E [email protected] upgraded it and the build passed.
  • Re-checked Nov 30, 2026 (research/vite-test/advisory-recheck-2026-11-30.txt): the repo advisory is unchanged (same affected and patched ranges, no CVE listed); GitHub’s global advisory page and API and OSV still return 404; npm’s bulk advisory endpoint lists nothing for 8.3.6 and npm audit on a fresh lockfile with vite 8.3.6 still says found 0 vulnerabilities. npm latest is now 8.4.0 (Nov 26), outside the affected ranges; 8.2.5 still doesn’t exist. Our own site’s build had vite 6.4.4 (affected range, dev server never exposed; we only run a static build); we upgraded it to 6.4.6 today.
  • Docs-based (fetched Nov 19, 2026, all HTTP 200):
    • The advisory: affected and patched ranges, scope (only --host / server.host), Critical, CVSS 4.0 vector, published Nov 10, 2026.
    • Vite server, preview and CLI options and their docs.
    • Docker port publishing.
    • The npm registry: 8.2.5 doesn’t exist and 8.2.6 is the 8.2 fix; no 4.x or 5.x fix; 8.3.8 is latest.
    • GitHub’s global advisory API returned 404 for this GHSA.
  • From public code, not vendor docs:
    • Lovable vite.config.ts and package.json files in 3 older public repos (host: "::", vite ^5.4.x).
    • 20 recent public Lovable repos (18 pinned vite 8.1.5).
    • The @lovable.dev/vite-tanstack-config 2.27.2 source, which sets host: "::", port 8080 outside the sandbox. We read it with npm pack and didn’t run it.
  • Not tested: the exploit itself, a real attack, Docker publishing (docs-based), Windows/WSL, and Lovable’s hosted editor or sandbox. “User config overrides the Lovable default” comes from reading mergeConfig order, not from running it.
  • Reported by others, not verified by us: a honeypot operator (@LupovisDefence) said on X that it saw an unauthenticated RCE attempt on Nov 18.

Related: Your app is public to anyone with the link, Claude Code saved secrets in settings.local.json, find and fix leaked API keys, 404 on refresh in a React/Vite app, and Module not found on Vercel.

When to get help

Get help if a vulnerable dev server was reachable from the internet (a cloud VM, a Docker host with a public IP, or a production site that answers /@vite/client), if your production deploy runs vite or npm run dev and you're not sure how to switch to a real build, if you can't upgrade because a plugin or the Lovable config breaks, or if you need to know what an attacker could have read from that machine.

FAQ

Is my Vite app affected by GHSA-p4f5-76q4-ffq7?

Only if both are true: your installed vite is in an affected range (4.0.0–6.4.5, 7.0.0–7.3.7, 8.0.0–8.1.6, 8.2.0–8.2.4, 8.3.0–8.3.6; vite-plus 1.5.0 or older) and the dev server is exposed to the network with --host or server.host. The advisory says only apps that explicitly expose the dev server are affected. A static build served by Vercel, Netlify or Cloudflare Pages doesn't run the dev server, so the live site isn't affected unless your start command runs vite or npm run dev.

Which vite version fixes it?

Upgrade to 8.3.8 or newer (8.4.0, released Nov 26, is the npm latest on Nov 30, 2026 and is outside the affected ranges), or the patched release on your line: 8.3.7, 8.2.6, 8.1.7, 7.3.8 or 6.4.6. vite-plus is fixed in 1.5.1. The advisory lists 8.2.5 as patched, but 8.2.5 was never published to npm; use 8.2.6. There is no patched 4.x or 5.x release, so projects on vite 5 (common in older Lovable exports) need to move to at least 6.4.6.

npm audit says 0 vulnerabilities. Am I safe?

Not necessarily. On Nov 19, and again on Nov 30, 2026, npm audit printed "found 0 vulnerabilities" for vite 8.3.6, which is affected, in our test. The advisory is published on Vite's GitHub repository, but GitHub's global advisory API (and OSV) still returned 404 for it on Nov 30, and that database is what npm audit checks. Compare the version from npm ls vite --all against the ranges yourself.

What does --host do in Vite?

Vite's docs say server.host defaults to localhost; setting it to 0.0.0.0 or true (CLI --host) makes the dev server listen on all addresses, including LAN and public ones. Vite prints "Network: use --host to expose" when it's local only, and a "Network: http://..." address when it's exposed. "::" also exposes it: in our test host "::" listened on all interfaces and answered on the machine's network IP.

Does a Lovable project I run locally expose the dev server?

In the projects we checked, yes by default. Older Lovable exports have server: { host: "::", port: 8080 } in vite.config.ts with vite 5.4.x. Newer TanStack-based exports have no host in vite.config.ts, but the @lovable.dev/vite-tanstack-config package (2.27.2) sets host "::" and port 8080 outside Lovable's sandbox, and 18 of the 20 recent exports we sampled pinned vite 8.1.5. Both versions are affected. This is from reading public repos and the package code, not Lovable's docs. We didn't check Lovable's hosted editor previews, which run on Lovable's infrastructure.

Is vite preview safe to use in production?

No. Vite's docs say vite preview is for previewing the build locally and "Do not use this as a production server". preview.host also defaults to server.host, so a config with server.host: true exposes vite preview too (our test confirmed it). The advisory covers the dev server, not preview, but serve production from a static host or a real server.

My dev server was exposed on an affected version. What now?

Upgrade, close the exposure, and then assume anything the dev server's user could read may be gone: rotate .env secrets, database and cloud keys, Stripe keys, SSH keys and npm or GitHub tokens, and check for unknown processes, cron jobs, startup items or changed files. The advisory describes reading files outside the project and running code. One honeypot operator reported on X on Nov 18 that it was already seeing attempts (we haven't verified that report). If it was a cloud VM or a shared server, rebuilding it is often faster than proving it's clean.

Sources

Related fixes