Vite Dev Server RCE: Why Your --host Flag Is the Risk
A critical Vite dev server RCE (GHSA-p4f5-76q4-ffq7, CVSS 9.1) hits any project launched with --host. Here's the exact fix and a safer config for 2026.
By Babul Jack
A critical Vite dev server RCE, tracked as GHSA-p4f5-76q4-ffq7, lets an attacker run arbitrary code on any machine where the dev server was started with --host or server.host. It was published on November 10, 2026, rated Critical with a CVSS v4 score of 9.1, and fixed in Vite 8.3.7, 8.2.5, 8.1.7, 7.3.8, and 6.4.6. If your team runs vite --host for mobile testing or shared staging, you need to patch today.
I read through the advisory the day it went public because half of my client projects sit on a Vite-based stack — plain Vite, Vue, SvelteKit, or Astro. The bug lives in Vite's resolver plugin, specifically in two internal virtual modules: __vite-browser-external:<suffix> and __vite-optional-peer-dep:<suffix>.
Vite builds these module IDs from the request URL without escaping the suffix. Since Vite trusts its own generated module code, an attacker can smuggle executable JavaScript into that suffix. According to the advisory, this creates two separate problems:
Modules referenced inside the injected code are treated as part of the dependency graph, so they bypass the server.fs allow-list check that normally blocks reading files outside your project.
Vite uses eval internally to resolve values for new Worker() and import.meta.glob(). The same injection point lets an attacker reach that eval path and run code directly on the server process.
The GitHub advisory includes a working proof of concept: a crafted GET /@id/__vite-browser-external:... request pulls an arbitrary file (for example /@fs/tmp/decoy-secret.txt) into the module graph, then a follow-up request to /@fs/... returns its contents. The same path chain can reach globalThis.process.getBuiltinModule, which is enough for full code execution on the host running the dev server.
The weakness is classified as CWE-116, improper encoding of output — a reminder that string interpolation into generated code is still one of the most common ways local dev tools turn into remote attack surfaces.
Who is actually exposed
This is not a build-time or production bug. Production bundles from vite build do not contain the dev server at all, so deployed apps are unaffected.
The condition that matters is in the advisory itself: the dev server has to be explicitly exposed to the network, using the --host CLI flag or the server.host config option. A default vite dev or vite run, bound to localhost, is not reachable from this bug.
In practice, I see three setups that trip this:
A developer runs vite --host to test a responsive layout on a phone over Wi-Fi, then leaves it running.
A shared staging or preview environment runs the Vite dev server (not a production build) behind a reverse proxy, with server.host: '0.0.0.0' baked into vite.config.ts.
A Docker container sets CMD ["vite", "--host"] so the container's port mapping works, exposing the server to anything that can reach the host network.
If none of your Vite projects ever bind to a non-loopback address, you are not exposed to this specific advisory — but you should still patch, because the fix also hardens the underlying module-resolution path in Rolldown for Vite 8.
How to check and fix it right now
1. Find every exposed dev server
Search your repos and Dockerfiles for the flag and config option:
Check your installed version, then bump to the patched line for your major version:
npx vite --version
Line
Vulnerable range
Patched version
Vite 8.3
8.3.0 – 8.3.6
8.3.7 (8.3.8 latest)
Vite 8.2
8.2.0 – 8.2.4
8.2.5
Vite 8.1
8.0.0 – 8.1.6
8.1.7
Vite 7
7.0.0 – 7.3.7
7.3.8
Vite 6 and older
4.0.0 – 6.4.5
6.4.6
vite-plus
≤ 1.5.0
1.5.1
npm install vite@latest --save-dev
# or pin to the exact patched line for your major version
npm install vite@8.3.8 --save-dev
Restart every running dev server after upgrading — a stale process keeps the vulnerable code loaded in memory even after package.json changes.
3. Lock the dev server down even if you can't patch today
If a dependency pin or a monorepo freeze stops you from upgrading immediately, remove the exposure instead:
Drop --host from package.json scripts and from any CMD/command in Dockerfiles or docker-compose files.
Remove or unset server.host in vite.config.ts, or set it back to 'localhost'.
If another device genuinely needs to reach the server, use an SSH tunnel (ssh -L 5173:localhost:5173 user@host) instead of opening the port.
Never run the Vite dev server, patched or not, on a machine or container that also holds production credentials.
Why allowedHosts matters even after you patch
Patching this specific RCE does not make --host risk-free. Vite's own docs carry a separate warning about server.allowedHosts: setting it to true lets any website send requests to your dev server through DNS rebinding, a distinct issue tracked as GHSA-vg6x-rcgg-rjx6.
The safer pattern, straight from Vite's configuration docs, is an explicit allow-list:
Never add a top-level domain or a domain you don't control to that list — anyone can register a lookalike domain and point it at an attacker's IP. I also keep server.fs.strict at its default of true on every client project; it blocks the dev server from serving files outside the project root even when a request manages to reference them.
Does this affect frameworks built on Vite?
Yes, indirectly. SvelteKit, Astro, Vue's CLI, and Laravel's Vite plugin all shell out to the same vite dev command under the hood, so the fix is the same: bump the underlying vite package in your lockfile and confirm npm ls vite shows a patched version, even if your framework's own package.json doesn't pin it directly.
Next.js is not affected by this advisory — it uses Turbopack for next dev rather than Vite, though both projects have spent 2026 converging on similar dev-server caching and prefetching ideas, which I covered when I migrated client apps through the Next.js 16 Cache Components changes.
What this means for CI and shared dev environments
Most teams I work with treat the Vite dev server as a purely local tool, but 2026 has normalized shared cloud dev environments — GitHub Codespaces, Gitpod, Replit, and internal "dev-in-the-cloud" boxes — where --host is often the default so a teammate or a QA tester can open the preview URL. That is exactly the exposure condition this advisory targets.
Before this advisory, I'd already started treating any cloud dev box running a framework dev server the same way I treat a staging API: patched dependencies, no production secrets on the box, and an explicit host allow-list rather than a wildcard. That habit paid off here — none of the client environments I checked needed anything beyond a routine npm update.
If your CI pipeline spins up a Vite dev server for end-to-end tests (rather than testing against a production build), check that pipeline too. A CI runner that temporarily binds to 0.0.0.0 inside a shared network is still "explicitly exposed" in the sense the advisory describes, even if the window is only a few minutes.
While you're touching the build toolchain, it's also worth checking whether your type-checking step is still on the older TypeScript compiler — I walked through the breaking changes and performance gains in my TypeScript 7 migration guide, which pairs well with a dependency audit like this one.
Frequently asked questions
Is my production Vite app affected by GHSA-p4f5-76q4-ffq7?
No. The vulnerability lives entirely in the dev server's request-handling code, which never ships in a vite build output. Only machines actively running vite or vite dev with network exposure are at risk.
Do I need a CVE ID to justify patching this?
No CVE had been assigned as of this advisory's publication, and it won't appear in the NVD under that identifier. Treat the GHSA ID as authoritative — GitHub's own advisory database is the primary source, and the fix is already published to npm.
What's the fastest way to confirm I'm safe?
Run npx vite --version in every project, compare it against the patched-version table above, and grep your scripts and Dockerfiles for --host. If both checks come back clean, you're not exposed.
Should I disable allowedHosts entirely to be safe?
No — disabling the host check (allowedHosts: true or 'all') removes a different protection against DNS rebinding attacks. Use an explicit list of hostnames you control instead of turning the check off.
Is this related to the npm supply-chain attacks from earlier in 2026?
Not directly — this is a code-escaping bug in Vite's own resolver, not a compromised package. But the fix pattern is the same discipline I cover in my guide to npm supply chain attack prevention: pin exact versions, review lockfile diffs, and patch fast when a maintainer-published advisory lands.
In client engagements I run through exactly this kind of exposure check as part of hardening a web app before launch — if you want a second set of eyes on your stack's dev-server and deployment configuration, that is part of what I offer through web app development.
Key takeaways
GHSA-p4f5-76q4-ffq7 is a Critical (CVSS 9.1) RCE in Vite's dev server, published November 10, 2026.
It only affects dev servers explicitly exposed with --host or server.host — not production builds.
Patch to Vite 8.3.7, 8.2.5, 8.1.7, 7.3.8, or 6.4.6 (or vite-plus 1.5.1), then restart every running dev process.
If you can't patch immediately, drop --host and bind to localhost, or use an SSH tunnel instead of opening the port.
Pair the patch with an explicit server.allowedHosts list — never true — to also close the separate DNS-rebinding risk.
Frameworks that wrap Vite (SvelteKit, Astro, Vue CLI) inherit the fix once their underlying vite dependency is upgraded.