Skip to main content

Vitest CVE-2026-84373

| EUVDEUVD-2026-69705 MEDIUM
Path Traversal (CWE-22)
2026-09-01 GitHub_M GHSA-82fw-gwwq-j7x9
5.9
CVSS 3.1 · Vendor: GitHub_M
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Connect to exposed HMR WebSocket on port 5173
  2. Delivery
    Send vitest:interceptor:register with opaque-scheme traversal URL
  3. Exploit
    path.join resolves redirect target outside project root
  4. Execution
    Attacker requests virtual /mock module
  5. Persist
    load hook calls readFile on traversed path
  6. Impact
    File contents returned as module source to attacker

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A01:2025 - Broken Access Control
ASVS 5.0
V5 - File Handling Path canonicalization, traversal prevention
MITRE ATT&CK

2 techniques across 2 tactics: Discovery, Collection

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Exploitation Conditions

Exploitation requires the Vite HMR WebSocket port (default 5173) to be reachable from an untrusted network - by default Vite binds to localhost only, so this is not reachable remotely unless the developer starts the server with --host 0.0.0.0, server.host: true, exposes the port via Docker port mapping, or operates in a cloud development environment (e.g., GitHub Codespaces, Gitpod) where ports are forwarded. The vitest:interceptor:register WebSocket handler requires no authentication. Exploitation further requires sending a redirect URL using an opaque URL scheme (e.g., traversal:, custom:) so that URL.pathname retains literal .. segments that path.join() resolves; standard relative paths or file:// URLs may be normalized by the parser and fail to traverse. The vitest browser mode RPC path is NOT exploitable via the unauthenticated WebSocket because it uses a separate token-authenticated channel. Vitest is a development-only tool and should never be exposed on production systems.

Impact

The CVSS 5.9 (AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N) is well-calibrated. AC:H reflects a genuine exploitation prerequisite: the attacker must use an opaque URL scheme to prevent .. normalization, a non-obvious but documented technique. Confidentiality impact is high because the attacker can read arbitrary files accessible to the dev-server process - potentially source code, credentials, private keys, or .env files. No integrity or availability impact applies. No EPSS score was provided; real-world exploitation probability is substantially constrained by the deployment context: Vite dev servers bind to localhost by default, meaning exploitation requires either an insider-adjacent network position or a developer deliberately exposing the HMR port (e.g., --host 0.0.0.0, Docker port mapping, or a cloud development environment). No KEV listing and no known active exploitation reduce urgency for most organizations. However, the fix PR's e2e test (mocker-redirect-traversal.test.ts) provides a complete, copy-pasteable WebSocket PoC, lowering the barrier for exploit development significantly. For teams running Vitest in CI pipelines on shared runners or network-accessible cloud dev environments, risk is meaningfully higher than the CVSS base score alone suggests.

Exploit ScenarioDerived

An attacker on the same network as a developer running vitest --host 0.0.0.0 connects directly to the exposed Vite HMR WebSocket on port 5173 and sends a crafted JSON message of type custom with event vitest:interceptor:register and a redirect field set to traversal:../../../home/developer/.env. The interceptor resolves the path outside the project root and registers the traversed file as a mock redirect; when the attacker subsequently requests the /mock virtual module endpoint, the dev server returns the .env file contents as JavaScript module source. The GitHub PR #10972 e2e test demonstrates this exact payload, making exploit construction trivial for anyone who reads the patch.

This Month Plan within 30 days. Why: MEDIUM severity (CVSS 4.0-6.9).
Patch available 0.4% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Sep 01, 2026

Path traversal in Vitest's interceptorPlugin exposes local files on any development server with a network-accessible HMR WebSocket. The vitest:interceptor:register handler in packages/mocker/src/node/interceptorPlugin.ts accepts redirect mock registrations over Vite's unauthenticated HMR socket without calling isFileLoadingAllowed(), allowing a remote unauthenticated attacker who can reach the dev server to submit opaque-scheme URLs (e.g., traversal:../../../etc/passwd) whose .. segments survive URL.pathname parsing and resolve outside the project root via path.join(). The plugin's load hook then returns readFile(mock.redirect, 'utf-8') as JavaScript module source, disclosing any file readable by the dev-server process. No public exploit or CISA KEV listing has been identified, but the GitHub fix PR includes a complete, working e2e test that serves as a functional PoC.

RemediationAI

Vendor-released patches are confirmed at Vitest 4.1.11 (https://github.com/vitest-dev/vitest/releases/tag/v4.1.11) and 5.0.0-rc.2 (https://github.com/vitest-dev/vitest/releases/tag/v5.0.0-rc.2), delivered via commits 51edf2b072902aec6d30c90ebaafd8f121c6f9d8, 8ff9b9a9efca7c6cfd5243569440de8d7a33aec4, and fe5a11d3ceac5ec10d6d7d21a46d4caca132c48f. Upgrade to 4.1.11 (stable) or 5.0.0-rc.2 (release candidate) immediately. As an interim compensating control pending upgrade, ensure Vite dev servers are not started with --host 0.0.0.0 or server.host: true, and use firewall rules or network policy to restrict the HMR WebSocket port (default 5173) to trusted hosts only - note that this does not fix the underlying code path and should not substitute for patching. If using browser mode, confirm that the token-authenticated RPC path is in use and that the unauthenticated WebSocket path is not reachable externally. The advisory is at https://github.com/vitest-dev/vitest/security/advisories/GHSA-82fw-gwwq-j7x9.

Affected VersionsENISA

mocker 2.1.0, < 4.1.11
vitest 5.0.0-beta.1, < 5.0.0-rc.2
mocker 5.0.0-beta.1, < 5.0.0-rc.2
vitest 2.1.0, < 4.1.11

Affected Packages

npm @vitest/mocker fix: 4.1.11, 5.0.0-rc.2
npm vitest fix: 4.1.11, 5.0.0-rc.2
euvd mocker_2_1_0 fix: 4.1.11
euvd mocker_5_0_0_beta_1 fix: 5.0.0-rc.2
euvd vitest_5_0_0_beta_1 fix: 5.0.0-rc.2

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 5 packages in npm, euvd

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

Vitest (CPE: cpe:2.3:a:vitest-dev:vitest) ships an @vitest/mocker subpackage (CPE: cpe:2.3:a:@vitest:mocker) that implements redirect mocking: a virtual module can be transparently substituted with the contents of another file at dev-server runtime. The interceptorPlugin() and mockerPlugin() exports register a vitest:interceptor:register WebSocket event handler on Vite's HMR socket in configureServer. This handler calls join(server.config.root, redirectUrl.pathname) to resolve the target path, but omits the isFileLoadingAllowed(server.config, redirect) boundary check that Vite's own static file middleware enforces via server.fs.allow and server.fs.deny. CWE-22 (Improper Limitation of a Pathname to a Restricted Directory) is the root cause: when the redirect URL uses an opaque scheme (non-http/file prefix), the WHATWG URL parser stores the full literal path - including .. segments - in pathname, which path.join() then resolves relative to the project root, escaping it. The fix (commits 51edf2b, 8ff9b9a, fe5a11d) adds the missing isFileLoadingAllowed call and also adds registerWebSocketEvents: false to the browser mode path, which instead routes mocks through a token-authenticated RPC channel.

Know when Vitest gets its next vulnerability

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (GitHub_M) PRIMARY 5.9 MEDIUM
AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N
vuln.today AI 5.9 MEDIUM

AV:N because the exploited WebSocket is network-reachable when exposed; AC:H for the opaque URL scheme requirement; PR:N since the HMR socket is unauthenticated; C:H for arbitrary local file read; I:N/A:N as only disclosure occurs.

3.1 AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:N/A:N
4.0 AV:N/AC:H/AT:N/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N
SUSE MEDIUM
Red Hat 5.9 MEDIUM

Primary rating from Vendor (GitHub_M).

CVSS VectorVendor: GitHub_M

Attack Vector
Network
Attack Complexity
High
Privileges Required
None
User Interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
None
Availability
None

Lifecycle Timeline

1
Patch available
Sep 01, 2026 - 23:18 EUVD

DescriptionCVE.org

Vitest is a testing framework powered by Vite. From 2.1.0 until 4.1.11 and 5.0.0-rc.2, the public mockerPlugin and standalone interceptorPlugin exports in packages/mocker/src/node/interceptorPlugin.ts register the vitest:interceptor:register handler on Vite's unauthenticated HMR WebSocket without validating redirect targets against the file-serving allowlist. The implementation processes event.redirect without enforcing server.fs.allow and server.fs.deny through isFileLoadingAllowed. A remote client that can reach an exposed development server can submit an opaque URL scheme preserving .. segments, causing join(server.config.root, redirectUrl.pathname) to resolve outside the project root. The plugin's load hook then returns readFile(mock.redirect, 'utf-8') as module source, disclosing local files readable by the dev-server process. Vitest browser mode uses a token-authenticated RPC and is not remotely unauthenticated by default, although the same boundary check was missing on that path. This issue is fixed in versions 4.1.11 and 5.0.0-rc.2.

Threat Intelligence Overview

EPSS Score
0.4%
Top 69% exploitable
Prevalence
Medium
popular JS/Vite ecosystem testing framework, dev-only deployment
Threat Intel
1
1 sources
Data Quality
7 sources
Confidence: High
EUVD NVD CVE.org EPSS Vulnrichment GHSA Vendor GitHub

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity MEDIUM
CISA KEV No
Public POC No
EPSS 0.4%
Patch available Yes
Active threat No
Deciding rule
MEDIUM severity (CVSS 4.0-6.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Scheduled
Exploitation
None
System Exposure· derived
Open
Automatable
No
Human Impact· derived
Medium
Technical Impact
Partial

Priority Score

30
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +30
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Path traversal exploits occur when applications use user-controlled input to construct file system paths without proper validation.

Vendor StatusVendor

SUSE

Severity: Moderate
Product Status
SUSE Linux Enterprise Module for Package Hub 15 SP7 Affected
SUSE Linux Enterprise Server 16.0 Affected
SUSE Linux Enterprise Server for SAP applications 16.0 Affected
SUSE Manager Client Tools 15 Affected
SUSE Manager Client Tools for SLE 15 Affected

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy