@vitest/browser: Browser Mode provider commands bypass the file-access permission gate
A vulnerability in @vitest/browser's Browser Mode allows certain built-in commands to bypass the file-access permission gate. These commands can read, write, or delete files anywhere accessible by the Vitest process, ignoring the allowWrite flag and path confinement. This is particularly risky when the Browser Mode API is exposed beyond localhost, enabling arbitrary file read and modification by untrusted clients. The vulnerability affects versions >=4.0.0 <4.1.10 and <3.2.7. A fix is planned to enforce allowWrite checks and restrict paths to the project root.
AI Analysis
Technical Summary
The @vitest/browser Browser Mode exposes commands running on the Node.js side that interact with the local filesystem. Several commands accept file paths from the browser and perform operations without verifying the allowWrite permission or restricting paths to the project directory. This allows clients with access to the Browser Mode API to read arbitrary local files, write PNG screenshots or Playwright trace archives to arbitrary locations, and delete files, even when allowWrite is false. The vulnerability is most impactful when the API is network-exposed, as allowWrite defaults to false to block file access in such cases. The fix involves adding allowWrite checks and path confinement to all file-touching commands, rejecting absolute paths and directory traversal sequences.
Potential Impact
An attacker able to reach the Browser Mode API can read arbitrary local files, exposing sensitive data. They can also create, overwrite, or delete files at arbitrary paths, though write operations are limited to generated PNG or trace archive files rather than attacker-controlled content. This leads to confidentiality breaches and potential integrity loss of files accessible by the Vitest process. The vulnerability is critical due to the ability to bypass intended file access restrictions and the potential for remote exploitation if the API is exposed beyond localhost.
Mitigation Recommendations
Patch status is not yet confirmed — check the vendor advisory for current remediation guidance. The planned fix adds allowWrite permission checks for write and delete operations and confines file paths to the project root, rejecting absolute paths and directory traversal. Until a patch is available, avoid exposing the Browser Mode API to untrusted networks or clients, and do not rely solely on allowWrite: false for security containment.
@vitest/browser: Browser Mode provider commands bypass the file-access permission gate
Description
A vulnerability in @vitest/browser's Browser Mode allows certain built-in commands to bypass the file-access permission gate. These commands can read, write, or delete files anywhere accessible by the Vitest process, ignoring the allowWrite flag and path confinement. This is particularly risky when the Browser Mode API is exposed beyond localhost, enabling arbitrary file read and modification by untrusted clients. The vulnerability affects versions >=4.0.0 <4.1.10 and <3.2.7. A fix is planned to enforce allowWrite checks and restrict paths to the project root.
CVSS v3.1
Affected software
Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
The @vitest/browser Browser Mode exposes commands running on the Node.js side that interact with the local filesystem. Several commands accept file paths from the browser and perform operations without verifying the allowWrite permission or restricting paths to the project directory. This allows clients with access to the Browser Mode API to read arbitrary local files, write PNG screenshots or Playwright trace archives to arbitrary locations, and delete files, even when allowWrite is false. The vulnerability is most impactful when the API is network-exposed, as allowWrite defaults to false to block file access in such cases. The fix involves adding allowWrite checks and path confinement to all file-touching commands, rejecting absolute paths and directory traversal sequences.
Potential Impact
An attacker able to reach the Browser Mode API can read arbitrary local files, exposing sensitive data. They can also create, overwrite, or delete files at arbitrary paths, though write operations are limited to generated PNG or trace archive files rather than attacker-controlled content. This leads to confidentiality breaches and potential integrity loss of files accessible by the Vitest process. The vulnerability is critical due to the ability to bypass intended file access restrictions and the potential for remote exploitation if the API is exposed beyond localhost.
Mitigation Recommendations
Patch status is not yet confirmed — check the vendor advisory for current remediation guidance. The planned fix adds allowWrite permission checks for write and delete operations and confines file paths to the project root, rejecting absolute paths and directory traversal. Until a patch is available, avoid exposing the Browser Mode API to untrusted networks or clients, and do not rely solely on allowWrite: false for security containment.
Technical Details
- Gcve Source
- db.gcve.eu
- Osv Id
- GHSA-p63j-vcc4-9vmv
- Osv Schema Version
- 1.4.0
- Aliases
- []
- Ecosystems
- ["npm"]
- Database Specific Severity
- CRITICAL
- Cvss Version
- 3.1
Threat ID: 6a600ac39c2644c7f8fe33ce
Added to database: 07/22/2026, 00:11:47 UTC
Last enriched: 07/22/2026, 00:56:23 UTC
Last updated: 07/22/2026, 02:11:23 UTC
Views: 6
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.