Your RSA-2048 keys break in 2030. Find every one of them before attackers do.
📦
📦 npm
Not in CISA KEV
MEDIUM severity

CVE-2026-112948 — @vitest/ui

MEDIUMFix: vitest-dev/vitest@28dc1ed

CVE-2026-112948 is a medium-severity (CVSS 6.5) Information Exposure vulnerability in @vitest/ui. A fix is available for @vitest/ui — see the affected versions and patch details below.

Vitest: Servers misapply `server.fs.deny`, serving `.env`, private keys, `.git`, and the API token file

Also known asGHSA-p458-7748-mcp3
Published
Updated
Affected
3 pkgs
Patched
3 / 3
Exploits
None indexed
Exploitation data as of Oct 22, 2026 · OSV.dev, NVD, FIRST.org (EPSS)

Exploitation Status

No confirmed exploitation observed yet

  • CISA’s own triage has not observed active exploitation or public proof-of-concept code for this CVE as of its last assessment.

Exploitation and automatability from CISA’s SSVC triage for CVE-2026-112948.

EPSS Exploitation Probability

via FIRST.org ↗
0.4%probability of exploitation in next 30 days
Lower Risk0.00%
Lower risk than most CVEs34th percentile — riskier than 34% of all scored CVEsHighest risk

Probability of exploitation in the next 30 days, from FIRST.org EPSS.

How urgent is this, really

CVE-2026-112948 by exploitation likelihood (EPSS) against impact (CVSS). Outside the shaded patch-first corner.

Where this sits among everything scored

Of 394,415 CVEs with a current EPSS score, this one falls in the < 10% band (highlighted). Counts from FIRST.org, log-scaled.

Real-World Exposure

3 pkgs affected

How broadly this vulnerability is actually deployed: weekly install volume shows current usage, and reverse-dependency count shows how many other packages break if it stays unpatched.

87other npm packages depend on this — each one inherits the vulnerability until it's patched upstream
@vitest/uinpm
9.7Mdownloads / week
@vitest/browsernpm
7.9Mdownloads / week
vite-plusnpm
1.6Mdownloads / week

Description

Summary

In Vitest 5, Vite's server.fs.deny is not applied as intended on Vitest's dev servers. Depending on the server, files that Vite refuses to serve by default (such as .env, private keys and certificates, .npmrc, and .git) or Vitest's own API token file (.vitest-secret-token) can be read over plain HTTP by a client that can reach the server. In Browser Mode with test.projects, a malicious website can also read .env values through the developer's browser.

This only applies when Vitest runs an HTTP server, which happens with the UI (--ui), Browser Mode, or api enabled. Plain vitest and vitest run don't listen on any port and are not affected. The fix ships in vitest, and @vitest/ui and @vitest/browser are listed because they are what enables the affected setups. Both pin vitest to the same version as a peer dependency, so upgrading either one also requires the patched vitest. Users who enable api without @vitest/ui or @vitest/browser are also affected and should upgrade vitest.

Details

Vitest 5 adds its API token file to server.fs.deny, but neither server ended up with the intended list. That's because of two Vite behaviors. Vite applies its default deny list only when server.fs.deny is unset, and it compiles the list into a matcher during config resolution, so later changes to the array have no effect.

setuplistening serverVite's default deny list.vitest-secret-token
plain vitest / vitest runnonenot reachablenot reachable
--ui or apirootdeniedserved (fallback location only)
Browser Mode, single projectroot (also the browser server)deniedserved (fallback location only)
Browser Mode with test.projectseach browser project's serverserveddenied
  • Project servers set deny: ['.vitest-secret-token'] from a config() hook, which replaces Vite's defaults. A project server listens on a port in Browser Mode with test.projects, so in that setup a request like GET /.env?raw returns the file. A plain GET /.env is also served as text/javascript, so a malicious page can include it with <script src="http://localhost:<port>/.env">. A classic script include needs no CORS, and each dotenv line whose value is valid JavaScript (a quoted string, number, or boolean) runs as a global assignment the page can read. A syntax error anywhere in the file, such as a # comment, keeps the whole script from running. The same missing defaults also loosen Browser Mode's file-access checks for server.readFile/writeFile/removeFile, screenshots, and traces.
  • The root server adds the token entry after Vite has compiled the matcher, so the entry is never applied. The token file normally lives in the per-user data directory, which is outside server.fs.allow. When that directory can't be written, for example in a container whose user has no writable HOME, Vitest falls back to <workspaceRoot>/node_modules/.vitest/.vitest-secret-token, which the root server then serves. The token authenticates the UI, /__vitest_attachment__, and the API WebSocket, whose RPC can write and rerun test files when api.allowWrite/api.allowExec are enabled.

Impact

Information disclosure from the Vitest dev server, and with the token, privileged API access.

  • From a malicious website, in Browser Mode with test.projects: while the browser server runs, any page the developer visits can read .env values that are valid JavaScript, through a classic <script> include. This works when the file consists of KEY="value" lines. An unquoted value causes a runtime error that stops the script at that line, so only the lines before it leak. A syntax error anywhere in the file, such as a # comment line or an export prefix, prevents the script from running at all. Recent Chrome versions may ask for Local Network Access permission first. fetch and XHR reads from other websites are still blocked by Vite's default CORS policy, and Vite's Host check blocks DNS rebinding. That CORS policy does allow localhost origins, so a page served from another local dev server could read full files. The token file can't be read through a classic <script>, because a bare token isn't valid JavaScript.
  • With local access or developer-set network exposure (such as api.host or browser.api.host, port forwarding, or a published container port): full file contents are readable over plain HTTP, including the token file when it's in the fallback location.

Only the machine running Vitest is exposed, while it runs one of the setups above. Applications built or deployed from the project aren't affected.

The fix is in vitest <PATCHED>. Vitest 4 and earlier are unaffected. They don't persist an API token, and they don't override server.fs.deny.

Workaround

Set server.fs.deny explicitly in the root Vitest config, including Vite's default list for your Vite version and the token file. For Vite 8.3:

export default defineConfig({
  server: {
    fs: {
      deny: [
        '.env',
        '.env.*',
        '*.{crt,pem,key,p12,pfx,cer,der}',
        '.npmrc',
        '.yarnrc.yml',
        '**/.git/**',
        '.vitest-secret-token',
      ],
    },
  },
})

Affected Packages

3 total 3 fixed
EcosystemPackageVulnerable rangeFix
📦npm@vitest/ui≥ 5.0.0-beta.6&&< 5.0.55.0.5npm install @vitest/ui@5.0.5
📦npm@vitest/browser≥ 5.0.0-beta.6&&< 5.0.55.0.5npm install @vitest/browser@5.0.5
📦npmvite-plus≥ 1.0.0-rc.0&&< 1.3.01.3.0npm install vite-plus@1.3.0

Detection & mitigation playbook

Open-source dependency
  1. Detect

    Scan your dependency tree (package-lock.json, pnpm-lock.yaml, requirements.txt, go.sum, etc.) for @vitest/ui, including transitive dependencies — a direct dependency you never call can still pull in a vulnerable version.

  2. Fix

    Update @vitest/ui to 5.0.5 or later, then make sure no transitive (indirect) dependency still pins the vulnerable range — O3 confirms CVE-2026-112948 is resolved across your whole dependency graph.

  3. Workarounds

    Assume what was exposed is already known: rotate any credential, token or key that the affected component could return, restrict the endpoint to callers that genuinely need it, and strip sensitive fields from responses and error output at the boundary rather than relying on the client not to read them.

Frequently Asked Questions

### Summary In Vitest 5, Vite's `server.fs.deny` is not applied as intended on Vitest's dev servers. Depending on the server, files that Vite refuses to serve by default (such as `.env`, private keys and certificates, `.npmrc`, and `.git`) or Vitest's own API token file (`.vitest-secret-token`) can be read over plain HTTP by a client that can reach the server. In Browser Mode with `test.projects`, a malicious website can also read `.env` values through the developer's browser. This only applies when Vitest runs an HTTP server, which happens with the UI (`--ui`), Browser Mode, or `api` enable
O3 Security · Impact-Aware SCA

Is CVE-2026-112948 in your dependencies?

Find it across npm, including transitive dependencies.

CVE-2026-112948: @vitest/ui — Fixed in 5.0.5