CVE-2026-47429: Vitest When Vitest UI Server Is Vulnerability

CRITICAL
Advisory Identifier: GHSA-5xrq-8626-4rwp
CVSS 9.8
CWE-862 CWE-22
Published
Advisory Summary

CVE-2026-47429 is a CRITICAL (CVSS 9.8) when vitest ui server is vulnerability (CWE-862: Missing Authorization) affecting Vitest libraries in the npm ecosystem. The issue involves when vitest ui server is listening, arbitrary file can be read and executed. Remediation is available by upgrading affected packages to version 4.1.0, 3.2.6.

CVE-2026-47429 at a Glance

CVE Identifier CVE-2026-47429
GHSA Identifier GHSA-5xrq-8626-4rwp
Severity CRITICAL
CVSS v3.1 Base Score 9.8
CWE Classification CWE-862: Missing Authorization
Affected Product Vitest
Package Ecosystem npm
Published Date
Last Updated

Security Impact

CVSS: 9.8

The security impact metrics below are parsed directly from the CVSS v3.1 vector string (CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H).

Attack Vector Network (AV:N)
Attack Complexity Low (AC:L)
Privileges Required None (PR:N)
User Interaction None (UI:N)
Scope Unchanged (S:U)
Confidentiality High (C:H)
Integrity High (I:H)
Availability High (A:H)

How to Fix CVE-2026-47429

To remediate this vulnerability, upgrade all affected Vitest dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

vitest fixed: 4.1.0
npm install vitest@4.1.0
vitest fixed: 3.2.6
npm install vitest@3.2.6
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

npm ls vitest

How to Check if You Are Affected

To determine whether your Node.js application is affected by CVE-2026-47429, inspect your project dependencies using npm:

npm ls vitest

Analyze the terminal output to locate any version of Vitest in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 4.1.0), your application is affected.

Note: The npm ls vitest command inspects dependencies declared in your package.json and lockfile; it does not perform automated runtime dynamic scanning.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-862: Missing Authorization, where the product does not perform an authorization check when an actor attempts to access a resource or perform an action. In Vitest, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Summary Arbitrary file can be read on Windows when Vitest UI server is listening, especially when exposed to the network. ### Impact Only users that match either of the following conditions are affected: - explicitly exposes the Vitest UI server to the network (using `--api.host` or [`api.host` config option](https://vitest.dev/config/api.html)) - running the Vitest UI or Browser Mode on Windows ### Details The API handler for `/__vitest_attachment__` uses the deprecated `isFileServingAllowed` incorrectly. https://github.com/vitest-dev/vitest/blob/eb1abf08573032a532015b999ad3501c5e89e3bb/packages/ui/node/index.ts#L77 The function expects the passed value to use `cleanUrl` after the check before file system related operation. Because of this, it is possible to bypass the check by `\\?\\..\\`. This is not possible on Linux as Linux errors if a directory named `?` does not exist. A similar problem exists in other places as well. - https://github.com/vitest-dev/vitest/blob/eb1abf08573032a532015b999ad3501c5e89e3bb/packages/vitest/src/api/setup.ts#L103-L105 - https://github.com/vitest-dev/vitest/blob/eb1abf08573032a532015b999ad3501c5e89e3bb/packages/vitest/src/api/setup.ts#L119-L121 - https://github.com/vitest-dev/vitest/blob/eb1abf08573032a532015b999ad3501c5e89e3bb/packages/browser/src/node/commands/fs.ts#L10-L11 - https://github.com/vitest-dev/vitest/blob/eb1abf08573032a532015b999ad3501c5e89e3bb/packages/browser/src/node/plugin.ts#L194-L196 - https://github.com/vitest-dev/vitest/blob/eb1abf08573032a532015b999ad3501c5e89e3bb/packages/browser/src/node/rpc.ts#L115-L121 **That said**, this `isFileServingAllowed` check does not actually prevent the API to be abused. Since the API has rerun feature and file write feature, it's possible to run arbitrary script by writing a script as a test file using `saveTestFile` and running it using `rerun`. This means exposing the API / Vitest UI is equivalent to giving script execution access. On the browser mode side, there're `readFile` / `writeFile` / `saveSnapshotFile`. So exposing the browser mode is equivalent to giving file read / write access. ### PoC 1. Run Vitest UI 2. Get the API token by `curl http://localhost:51204/__vitest__/` 3. Run `curl "http://localhost:51204/__vitest_attachment__?path=C:\\path\\to\\project\\?\\..\\..\\secret.txt&contentType=text/plain&token=$TOKEN"` (TOKEN is the API token) 4. curl shows the content of `secret.txt` that is outside the project directory ### Mitigations Vitest now ships two configuration flags, [`allowWrite`](https://vitest.dev/config/api.html#api-allowwrite) and [`allowExec`](https://vitest.dev/config/api.html#api-allowexec), that gate the privileged operations exploited by this vulnerability. Both are disabled by default whenever the API server is bound to a non-`localhost` host, ensuring that exposing the server to the network no longer implicitly grants write or execute capabilities to remote clients. When these flags are disabled, the UI also enters a read-only mode: in-browser code editing and test file execution are turned off, removing the attack surface that allowed remote code execution. Many Browser Mode features are also disabled, like attachments, artifacts or snapshots. See [`browser.api`](https://vitest.dev/config/browser/api.html#api-allowwrite). Users who require the full interactive UI on a networked host must explicitly opt in by setting `allowWrite` and/or `allowExec` to `true`.

CVE-2026-47429 Affected Vitest Versions

2 component(s)
Fixed Versions:
4.1.03.2.6
Product / Package Ecosystem Affected Versions Fixed Version
vitest
npm
≥ 4.0.0
< 4.1.0
4.1.0
vitest
npm
< 3.2.6
3.2.6

References

GitHub Advisory / Wiki ADVISORY
https://github.com/vitest-dev/vitest/security/advisories/GHSA-5xrq-8626-4rwp
NVD — CVE-2026-47429 NVD
https://nvd.nist.gov/vuln/detail/CVE-2026-47429
Vitest Source Repository REPOSITORY
https://github.com/vitest-dev/vitest/pull/10445
Vitest Source Repository REPOSITORY
https://github.com/vitest-dev/vitest/pull/9350
Security Fix Commit FIX COMMIT
https://github.com/vitest-dev/vitest/commit/20e00ef7808de6d330c5e2fda530f686e08f1c8d
Security Fix Commit FIX COMMIT
https://github.com/vitest-dev/vitest/commit/af88b1f5d82844a4761ea9a977156c98e2b14ca8
Vitest Source Repository REPOSITORY
https://github.com/vitest-dev/vitest
Vitest Source Repository REPOSITORY
https://github.com/vitest-dev/vitest/blob/eb1abf08573032a532015b999ad3501c5e89e3bb/packages/browser/src/node/commands/fs.ts#L10-L11
Vitest Source Repository REPOSITORY
https://github.com/vitest-dev/vitest/blob/eb1abf08573032a532015b999ad3501c5e89e3bb/packages/browser/src/node/plugin.ts#L194-L196
Vitest Source Repository REPOSITORY
https://github.com/vitest-dev/vitest/blob/eb1abf08573032a532015b999ad3501c5e89e3bb/packages/browser/src/node/rpc.ts#L115-L121
Vitest Source Repository REPOSITORY
https://github.com/vitest-dev/vitest/blob/eb1abf08573032a532015b999ad3501c5e89e3bb/packages/ui/node/index.ts#L77
Vitest Source Repository REPOSITORY
https://github.com/vitest-dev/vitest/blob/eb1abf08573032a532015b999ad3501c5e89e3bb/packages/vitest/src/api/setup.ts#L103-L105
Vitest Source Repository REPOSITORY
https://github.com/vitest-dev/vitest/blob/eb1abf08573032a532015b999ad3501c5e89e3bb/packages/vitest/src/api/setup.ts#L119-L121
Vitest Release RELEASE
https://github.com/vitest-dev/vitest/releases/tag/v3.2.5
Vitest Release RELEASE
https://github.com/vitest-dev/vitest/releases/tag/v4.1.0

Frequently Asked Questions

What is CVE-2026-47429?
CVE-2026-47429 is a security vulnerability in Vitest involving When Vitest UI server is listening, arbitrary file can be read and executed under CWE-862: Missing Authorization.
Which Vitest versions are affected?
Affected versions include releases prior to 4.1.0, 3.2.6 across affected packages: vitest.
What version fixes CVE-2026-47429?
Upgrading to 4.1.0, 3.2.6 (or the latest patched release for your respective branch) resolves the vulnerability.
Is vitest affected?
Yes, vitest is affected in releases prior to 4.1.0, 3.2.6. Upgrade your dependency to 4.1.0, 3.2.6 or later.
What is the CVSS score of CVE-2026-47429?
CVE-2026-47429 has a CVSS v3.1 base score of 9.8 (CRITICAL) with vector string CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H.
What CWE is associated with CVE-2026-47429?
CVE-2026-47429 is classified under CWE-862: Missing Authorization (The product does not perform an authorization check when an actor attempts to access a resource or perform an action.).
How can I check npm dependencies for CVE-2026-47429?
Run the dependency tree command: 'npm ls vitest'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-5xrq-8626-4rwp",
  "modified" : "2026-08-13T18:19:29Z",
  "published" : "2026-06-01T14:09:53Z",
  "aliases" : [ "CVE-2026-47429" ],
  "summary" : "When Vitest UI server is listening, arbitrary file can be read and executed",
  "details" : "### Summary\nArbitrary file can be read on Windows when Vitest UI server is listening, especially when exposed to the network.\n\n### Impact\nOnly users that match either of the following conditions are affected:\n\n- explicitly exposes the Vitest UI server to the network (using `--api.host` or [`api.host` config option](https://vitest.dev/config/api.html))\n- running the Vitest UI or Browser Mode on Windows\n\n### Details\nThe API handler for `/__vitest_attachment__` uses the deprecated `isFileServingAllowed` incorrectly.\nhttps://github.com/vitest-dev/vitest/blob/eb1abf08573032a532015b999ad3501c5e89e3bb/packages/ui/node/index.ts#L77\nThe function expects the passed value to use `cleanUrl` after the check before file system related operation.\nBecause of this, it is possible to bypass the check by `\\\\?\\\\..\\\\`. This is not possible on Linux as Linux errors if a directory named `?` does not exist.\n\nA similar problem exists in other places as well.\n- https://github.com/vitest-dev/vitest/blob/eb1abf08573032a532015b999ad3501c5e89e3bb/packages/vitest/src/api/setup.ts#L103-L105\n- https://github.com/vitest-dev/vitest/blob/eb1abf08573032a532015b999ad3501c5e89e3bb/packages/vitest/src/api/setup.ts#L119-L121\n- https://github.com/vitest-dev/vitest/blob/eb1abf08573032a532015b999ad3501c5e89e3bb/packages/browser/src/node/commands/fs.ts#L10-L11\n- https://github.com/vitest-dev/vitest/blob/eb1abf08573032a532015b999ad3501c5e89e3bb/packages/browser/src/node/plugin.ts#L194-L196\n- https://github.com/vitest-dev/vitest/blob/eb1abf08573032a532015b999ad3501c5e89e3bb/packages/browser/src/node/rpc.ts#L115-L121\n\n**That said**, this `isFileServingAllowed` check does not actually prevent the API to be abused. Since the API has rerun feature and file write feature, it's possible to run arbitrary script by writing a script as a test file using `saveTestFile` and running it using `rerun`. This means exposing the API / Vitest UI is equivalent to giving script execution access.\nOn the browser mode side, there're `readFile` / `writeFile` / `saveSnapshotFile`. So exposing the browser mode is equivalent to giving file read / write access.\n\n### PoC\n1. Run Vitest UI\n2. Get the API token by `curl http://localhost:51204/__vitest__/`\n3. Run `curl \"http://localhost:51204/__vitest_attachment__?path=C:\\\\path\\\\to\\\\project\\\\?\\\\..\\\\..\\\\secret.txt&amp;contentType=text/plain&amp;token=$TOKEN\"` (TOKEN is the API token)\n4. curl shows the content of `secret.txt` that is outside the project directory\n\n### Mitigations\n\nVitest now ships two configuration flags, [`allowWrite`](https://vitest.dev/config/api.html#api-allowwrite) and [`allowExec`](https://vitest.dev/config/api.html#api-allowexec), that gate the privileged operations exploited by this vulnerability. Both are disabled by default whenever the API server is bound to a non-`localhost` host, ensuring that exposing the server to the network no longer implicitly grants write or execute capabilities to remote clients.\n\nWhen these flags are disabled, the UI also enters a read-only mode: in-browser code editing and test file execution are turned off, removing the attack surface that allowed remote code execution. Many Browser Mode features are also disabled, like attachments, artifacts or snapshots. See [`browser.api`](https://vitest.dev/config/browser/api.html#api-allowwrite).\n\nUsers who require the full interactive UI on a networked host must explicitly opt in by setting `allowWrite` and/or `allowExec` to `true`.",
  "severity" : [ {
    "type" : "CVSS_V3",
    "score" : "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "npm",
      "name" : "vitest"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "4.0.0"
      }, {
        "fixed" : "4.1.0"
      } ]
    } ]
  }, {
    "package" : {
      "ecosystem" : "npm",
      "name" : "vitest"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "3.2.6"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/vitest-dev/vitest/security/advisories/GHSA-5xrq-8626-4rwp"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-47429"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/vitest-dev/vitest/pull/10445"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/vitest-dev/vitest/pull/9350"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/vitest-dev/vitest/commit/20e00ef7808de6d330c5e2fda530f686e08f1c8d"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/vitest-dev/vitest/commit/af88b1f5d82844a4761ea9a977156c98e2b14ca8"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/vitest-dev/vitest"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/vitest-dev/vitest/blob/eb1abf08573032a532015b999ad3501c5e89e3bb/packages/browser/src/node/commands/fs.ts#L10-L11"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/vitest-dev/vitest/blob/eb1abf08573032a532015b999ad3501c5e89e3bb/packages/browser/src/node/plugin.ts#L194-L196"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/vitest-dev/vitest/blob/eb1abf08573032a532015b999ad3501c5e89e3bb/packages/browser/src/node/rpc.ts#L115-L121"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/vitest-dev/vitest/blob/eb1abf08573032a532015b999ad3501c5e89e3bb/packages/ui/node/index.ts#L77"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/vitest-dev/vitest/blob/eb1abf08573032a532015b999ad3501c5e89e3bb/packages/vitest/src/api/setup.ts#L103-L105"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/vitest-dev/vitest/blob/eb1abf08573032a532015b999ad3501c5e89e3bb/packages/vitest/src/api/setup.ts#L119-L121"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/vitest-dev/vitest/releases/tag/v3.2.5"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/vitest-dev/vitest/releases/tag/v4.1.0"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-22", "CWE-862" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-06-01T14:09:53Z",
    "nvd_published_at" : "2026-07-14T20:17:02Z"
  }
}