---
id: "CVE-2026-112947"
kind: "vulnerability"
aliases: ["CVE-2026-112947", "GHSA-vfpm-58rq-9qcg"]
title: "Vite: First 4 bytes of files outside of `server.fs` setting is exposed by `?vite-wasm-instance`"
severity: "medium"
cvss: 6.3
epss: 0.004220000002533197
exploited: false
status: "open"
category: "package"
products: [{"name": "vite", "fixed": ["8.3.3"], "affected": ">= 8.3.0, <= 8.3.2", "ecosystem": "npm"}, {"name": "vite", "fixed": ["8.2.4"], "affected": ">= 8.2.0, <= 8.2.3", "ecosystem": "npm"}, {"name": "vite-plus", "fixed": ["1.1.0"], "affected": ">= 0.2.8, <= 1.0.0", "ecosystem": "npm"}]
ecosystems: ["npm"]
tags: ["cwe-200", "cwe-209", "cwe-22", "deno", "node.js", "npm", "package", "self-hosted", "vite"]
not_affected_if: ["bun-runtime", "default-config", "vite-version-outside-range"]
published_at: "2026-10-20T16:17:05+00:00"
first_seen_at: "2026-10-23T19:11:32+00:00"
updated_at: "2026-10-23T21:57:20+00:00"
sources: [{"source": "ghsa", "url": "https://github.com/advisories/GHSA-vfpm-58rq-9qcg", "first_seen_at": "2026-10-23T19:11:32+00:00"}, {"source": "nvd", "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-112947", "first_seen_at": "2026-10-23T21:57:20+00:00"}]
---

# Vite: First 4 bytes of files outside of `server.fs` setting is exposed by `?vite-wasm-instance`

Vite's dev server returns the first 4 bytes of files outside the server.fs allow list when a request includes ?vite-wasm-instance, because the internal Wasm plugin reads the file without the fs checks and includes the bytes in a WebAssembly parse error. An attacker who can reach the dev server can read the first 4 bytes of arbitrary readable files, such as secrets placed at the start of a file like .env.

_Summary, check and fix written by a model from the sources; labelled as such._

## Affected

- npm:vite affected >= 8.3.0, <= 8.3.2 fixed 8.3.3
- npm:vite affected >= 8.2.0, <= 8.2.3 fixed 8.2.4
- npm:vite-plus affected >= 0.2.8, <= 1.0.0 fixed 1.1.0

## How to check

Run npm ls vite (or check the lockfile) and confirm whether the installed version is in the affected ranges: vite 8.3.0 to 8.3.2, vite 8.2.0 to 8.2.3, or vite-plus 0.2.8 to 1.0.0.
Check whether the dev server is exposed with --host or server.host in vite.config.
Runtime must be Node.js or Deno; Bun is not affected per the advisory.

## Fix

Upgrade vite to 8.3.3 (on the 8.3 line) or 8.2.4 (on the 8.2 line); upgrade vite-plus to 1.1.0.
Until upgraded, do not expose the dev server to the network (remove --host and server.host).

## Timeline

- 2026-10-23T19:11:32+00:00 ghsa https://github.com/advisories/GHSA-vfpm-58rq-9qcg
- 2026-10-23T21:57:20+00:00 nvd https://nvd.nist.gov/vuln/detail/CVE-2026-112947

## From the sources

### Summary

The first 4 bytes of files outside of `server.fs` setting can be returned to the browser by a request containing `?vite-wasm-instance`.

### Impact

 Only apps that match one of the following conditions are affected:

- explicitly expose the Vite dev server to the network using `--host` or the [`server.host`](https://vite.dev/config/server-options#server-host) option
- there's a file that has a sensitive information in **the first 4 bytes**
- uses Node.js or Deno to run Vite (if Bun is used, it is not affected)

### Details
Requests containing the `?vite-wasm-instance` query are handled by the internal Wasm plugin's `load` hook. The hook removes the query and reads the resulting path directly from disk, but the `server.fs` checks were not applied.

After reading the file, Vite attempts to parse it as WebAssembly. When that parse fails, Node and deno throws an error that contains the first 4 bytes of the file.

### PoC

Create a denied file and start an affected Vite dev server:

```bash
echo 'SECRET_KEY=abc123\n' > .env
npm run dev
curl 'http://localhost:5173/.env?vite-wasm-instance'
```

This will show
```
Failed to parse WASM file "<root>/.env": WebAssembly.compile(): expected magic word 00 61 73 6d, found 53 45 43 52 @+0
```

---

_Free to read at a human pace. An API with keys and an MCP server are in preparation; early access: hello@infrastack.ai_
