CVE-2026-112949
Awaiting Analysis Awaiting Analysis - Queue

Unauthenticated JavaScript Execution in Vitest via WebSocket

Vulnerability report for CVE-2026-112949, including description, CVSS score, EPSS score, affected products, exploitability, helpful resources, and attack-flow context.

Publication date: 2026-10-20

Last updated on: 2026-10-23

Assigner: GitHub, Inc.

Description

Vitest is a Vite-native testing framework for JavaScript and TypeScript projects. From 2.1.0-beta.7 until 4.1.12 and 5.0.3, an unauthenticated non-browser WebSocket client that can reach a development server using interceptorPlugin can register a manual mock whose attacker-controlled url createManualModuleSource inserts unescaped into generated module source. When the developer browser loads the affected module, attacker-controlled JavaScript executes on the development-server origin. This issue is fixed in versions 4.1.12 and 5.0.3.

CVSS Scores

EPSS Scores

Probability:
Percentile:

Meta Information

Published
2026-10-20
Last Modified
2026-10-23
Generated
2026-11-09
AI Q&A
2026-10-20
EPSS Evaluated
2026-11-08
NVD
EUVD

Affected Vendors & Products

Showing 4 associated CPEs
Vendor Product Version / Range
vitest-dev vitest >= 2.1.0-beta.7, < 4.1.12
vitest-dev vitest >= 5.0.0, < 5.0.3
@vitest mocker >= 2.1.0-beta.7, < 4.1.12
@vitest mocker >= 5.0.0, < 5.0.3

Helpful Resources

Exploitability

CWE
CWE Icon
KEV
KEV Icon
CWE ID Description
CWE-306 The product does not perform any authentication for functionality that requires a provable user identity or consumes a significant amount of resources.
CWE-94 The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.
CWE-116 The product prepares a structured message for communication with another component, but encoding or escaping of the data is either missing or done incorrectly. As a result, the intended structure of the message is not preserved.

Attack-Flow Graph

AI Quick Actions

Instant insights powered by AI
Executive Summary

This is a code injection vulnerability in Vitest's mocker package. It allows an unauthenticated attacker with access to the dev server's port to register a malicious mock via WebSocket. The mock's URL is inserted into generated code without proper escaping, enabling arbitrary JavaScript execution in the developer's browser on the dev-server origin when the affected module loads.

Detection Guidance

Check if your Vitest version is affected by running: npm list @vitest/mocker. If the version is >= 2.1.0-beta.7 and < 4.1.12, the system is vulnerable. Monitor WebSocket connections to the Vitest dev server on port 5173 or similar.

Impact Analysis

An attacker could read your source code, access browser storage and cookies, drive same-origin requests, and maintain persistence across page reloads while the mock remains active. This occurs only if an attacker has network access to the dev server's port and the developer is using a vulnerable Vitest version.

Compliance Impact

This vulnerability could potentially impact compliance with GDPR and HIPAA by allowing an attacker to execute arbitrary JavaScript code in a developer's browser on the dev-server origin. This could lead to unauthorized access to sensitive data such as browser storage, cookies, or same-origin requests, which may include personal or health information. The attacker could also persist across page reloads while the mock remains registered, increasing the risk of prolonged unauthorized access.

Mitigation Strategies

Upgrade @vitest/mocker to version 4.1.12 or 5.0.3 or later immediately. Restrict network access to the Vitest dev server port. Avoid using untrusted WebSocket clients with the dev server.

Chat Assistant

Ask questions about this CVE
Hi! I’m here to help you understand CVE-2026-112949. Ask me anything about the vulnerability, its impact, or mitigation strategies.
0/70

EPSS Chart

Security Radar

News mentioning this vulnerability
Loading related security news...