/

CVE-2026-73653

Severity:

CRITICAL RISK

(9.4)

Path Traversal (CWE-22) in Vitest Browser Mode API

CVE-2026-73653

Deferred

Vulnerability type

Category:

Path Traversal

CWE:

CWE-22, CWE-552, CWE-862

Impact:

Arbitrary File Read, File Write, and File Deletion

Severity:

CRITICAL RISK

(9.4)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

A path traversal and missing authorization check in Vitest Browser Mode commands allows browser-supplied paths to bypass the allowWrite permission boundary. A client that can reach the Browser Mode API may read, create, overwrite, or delete files accessible to the Vitest process.

Affected context

The issue occurs in Vitest deployments that expose the Browser Mode API and process commands such as uploads, screenshots, tracing operations, or trace annotations. Risk increases when the API is reachable by an untrusted client, because supplied paths are not consistently restricted to the project root or governed by the write-permission setting.

Exploit preconditions

  • Attack surface: Vitest Browser Mode API
  • Required access: Ability to reach and submit commands to the Browser Mode API
  • Trigger point: Browser provider commands that accept file paths
  • Why exploitation is possible: The commands trust browser-supplied paths without consistently enforcing allowWrite or project-root confinement
  • Required runtime condition: The target files must be accessible to the Vitest process

Why this happens

The underlying flaw combines improper path validation with missing authorization enforcement. File-operation handlers accept client-provided paths without reliably canonicalizing and constraining them to an intended directory, while write-capable actions can proceed even when allowWrite is disabled. This behavior maps primarily to CWE-22: Improper Limitation of a Pathname to a Restricted Directory, with related concerns involving exposed file resources and missing authorization checks.

Potential impact

  • An attacker may read sensitive local files accessible to the Vitest process.
  • An attacker could create or overwrite image, screenshot, or trace files.
  • An attacker could delete files permitted by the process filesystem privileges.
  • Test artifacts, diagnostics, or project data could be tampered with.
  • File manipulation may contribute to broader application or development-environment compromise.

General mitigation guidance

Mitigation generally focuses on treating all browser-supplied paths as untrusted and enforcing authorization before any filesystem operation.

Common defensive patterns include:

  • Require an explicit write authorization gate for every write, overwrite, and delete operation.
  • Resolve and canonicalize paths, then enforce confinement beneath an approved project or artifact directory.
  • Prefer safe, server-generated filenames and opaque artifact identifiers over client-selected paths.
  • Use allowlisted operation-specific directories and file types.
  • Run the Vitest process with least-privilege filesystem permissions.
  • Keep the Browser Mode API on a trusted network boundary and require appropriate authentication.
  • Apply read-only filesystem controls where file creation or modification is unnecessary.

How teams detect issues like this

Organizations can look for:

  • Static analysis findings where request-derived values flow into filesystem APIs without canonicalization or directory-boundary checks.
  • Code review signals showing authorization checks applied to some file commands but omitted from related commands.
  • Tests that submit absolute paths, parent-directory segments, symlinked paths, and paths outside the project root.
  • Policy checks requiring centralized path-validation and permission-enforcement helpers for browser-facing file operations.
  • Runtime monitoring for unexpected reads, writes, overwrites, or deletions performed by the Vitest process.
  • Automated security review tools that identify path traversal and missing authorization patterns.

Sources

SourceLink
github.comgithub.com/vitest-dev/vitest/commit/33f96a145ef09ca6a43b4e555eb273e64a87be23
github.comgithub.com/vitest-dev/vitest/commit/5c18dd267ff7f47f24cab2f615a16b37d90feb7f
github.comgithub.com/vitest-dev/vitest/commit/b795e36b34969bec50b47a9f29d26f799a6a04fb
github.comgithub.com/vitest-dev/vitest/pull/10674
github.comgithub.com/vitest-dev/vitest/pull/10679
github.comgithub.com/vitest-dev/vitest/pull/10680
github.comgithub.com/vitest-dev/vitest/releases/tag/v3.2.7
github.comgithub.com/vitest-dev/vitest/releases/tag/v4.1.10
github.comgithub.com/vitest-dev/vitest/releases/tag/v5.0.0-beta.6
github.comgithub.com/vitest-dev/vitest/security/advisories/GHSA-p63j-vcc4-9vmv

Frequently asked

questions

It can be, when the Browser Mode API is reachable by an untrusted client. Exploitation does not require a general network exposure if an attacker can otherwise access the API through a development environment, shared test system, or compromised browser session.

The attacker needs the ability to send commands to the Browser Mode API. The affected files must also be readable, writable, or deletable by the Vitest process according to the requested operation.

Enforce authorization before each filesystem operation, canonicalize supplied paths, and restrict them to explicitly approved directories. Write and deletion commands should remain unavailable unless a dedicated permission is granted.

Centralize path validation, use server-controlled artifact identifiers, test boundary and symlink cases, restrict API exposure, and run test services with minimal filesystem privileges.

Find out what's already
exploitable in your codebase.