CVE-2026-112949: Vitest: Code injection via unauthenticated manual mock registration

Published Oct 20, 2026
·
Updated

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.

Affected Software

1 affected component
Vitest vitest>=2.1.0-beta.7<4.1.12, >=5.0.0<5.0.3

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade Vitest to a version that resolves this vulnerability.

    Fixed in 4.1.12
  2. Upgrade

    Upgrade Vitest to a version that resolves this vulnerability.

    Fixed in 5.0.3

Event History

Oct 20, 2026
CVE Published
via MITRE·03:19 PM
Data Sourced
via MITRE·03:19 PM
DescriptionSeverityWeakness
Data Sourced
via NVD·04:17 PM
DescriptionSeverityWeakness

Frequently Asked Questions

1

Which deployments are exposed to this issue?

Development servers using Vitest's interceptorPlugin are exposed if they run a vulnerable version and can be reached by an unauthenticated non-browser WebSocket client. The issue affects versions from 2.1.0-beta.7 up to, but not including, 4.1.12 and 5.0.3.

2

What must an attacker do to trigger code execution?

The attacker must be able to connect to the development server over WebSocket and register a manual mock with an attacker-controlled URL. Execution occurs when a developer's browser loads the affected generated module.

3

What is the impact of successful exploitation?

Attacker-controlled JavaScript executes on the development-server origin in the developer's browser. The stated impacts are limited confidentiality and integrity effects, with no availability impact.

4

What should teams do if they cannot patch immediately?

Limit access to affected development servers so unauthenticated non-browser WebSocket clients cannot reach them, and avoid exposing servers using interceptorPlugin to untrusted networks. Upgrade to 4.1.12 or 5.0.3 when possible.

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