CVE-2026-47429: Vitest: Arbitrary file can be read and executed when Vitest UI server is listening

Published Jun 1, 2026
·
Updated

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) - running the Vitest UI or Browser Mode on Windows

Details The API handler for /vitestattachment 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/vitestattachment?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 and 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.

Users who require the full interactive UI on a networked host must explicitly opt in by setting allowWrite and/or allowExec to true.

Other sources

Vitest is a testing framework powered by Vite. Prior to 3.2.5 and 4.1.0, the Vitest UI/API server on Windows used isFileServingAllowed incorrectly for /vitestattachment, allowing \\?\\..\\ path traversal to read files outside the project; exposed API write and rerun features such as saveTestFile and rerun could also allow arbitrary script execution. This issue is fixed in versions 3.2.5 and 4.1.0.

MITRE

Affected Software

3 affected componentsFixes available
npm/vitest<4.1.0
4.1.0
vitest.dev Vitest Node.js<3.2.5
vitest.dev Vitest Node.js>=4.0.0<4.1.0

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade npm/vitest to a version that resolves this vulnerability.

    Fixed in 4.1.0
  2. Upgrade

    Upgrade vitest to a version that resolves this vulnerability.

    Fixed in 3.2.5
  3. Upgrade

    Upgrade vitest to a version that resolves this vulnerability.

    Fixed in 4.1.0
  4. Configuration

    Ensure Vitest API flag allowWrite is not enabled (set allowWrite to false) so the UI/API runs in read-only mode when the server is reachable from a non-localhost host.

    Vitest UI/API server allowWrite = false
  5. Configuration

    Ensure Vitest API flag allowExec is not enabled (set allowExec to false) so privileged execution features are gated off when the UI/API server is reachable from a non-localhost host.

    Vitest UI/API server allowExec = false
  6. Compensating control

    If you must expose the Vitest UI/API server over the network, explicitly opt in only by setting allowWrite and/or allowExec to true; otherwise keep them disabled to avoid granting remote file read/write or execution capabilities.

Event History

Jun 1, 2026
Advisory Published
via GitHub·02:09 PM
Data Sourced
via GitHub·02:09 PM
DescriptionSeverityWeaknessAffected Software
Jul 14, 2026
CVE Published
via MITRE·07:28 PM
Data Sourced
via MITRE·07:28 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·08:17 PM
RemedyDescriptionSeverityWeaknessAffected Software

Frequently Asked Questions

1

What is the severity of CVE-2026-47429?

CVE-2026-47429 has a critical severity rating of 9.8.

2

How do I fix CVE-2026-47429?

To mitigate CVE-2026-47429, avoid exposing the Vitest UI server to the network.

3

What impact does CVE-2026-47429 have?

CVE-2026-47429 allows arbitrary file reading on Windows when the Vitest UI server is network-exposed.

4

Who is affected by CVE-2026-47429?

Users who expose the Vitest UI server to the network are specifically at risk from CVE-2026-47429.

5

When was CVE-2026-47429 published?

CVE-2026-47429 was published on June 1, 2026.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203