What’s Vulnerable › Vulnerabilities
CVE-2026-112949: Vitest: Code injection via unauthenticated manual mock registration
- Severity: medium (CVSS 4.7 v3.1)
- Exploited in the wild: not listed in CISA KEV
- EPSS: 0.3% probability of exploitation in the next 30 days
- Public exploit or detection template: none known
- Published: 2026-10-20 · updated 2026-10-23
- Weakness: CWE-94
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.
Affected products
- Npm @Vitest/Mocker: from 2.1.0-beta.7 before 4.1.12; from 5.0.0-beta.1 before 5.0.3 — fixed in 4.1.12, 5.0.3
- @vitest mocker: from 2.1.0-beta.7, < 4.1.12; from 5.0.0, < 5.0.3
- vitest-dev vitest: from 2.1.0-beta.7, < 4.1.12; from 5.0.0, < 5.0.3
How to fix
Upgrade to a fixed version: Npm @Vitest/Mocker 4.1.12, 5.0.3. Check the vendor advisory for mitigations.
References
- https://github.com/vitest-dev/vitest/commit/15cc006aa9f8683dc5f7e895d011fa7dc751ce35
- https://github.com/vitest-dev/vitest/commit/b825313243dc55757e8d7c0f9e7a792135e13473
- https://github.com/vitest-dev/vitest/releases/tag/v4.1.12
- https://github.com/vitest-dev/vitest/releases/tag/v5.0.3
- https://github.com/vitest-dev/vitest/security/advisories/GHSA-qxg6-89mg-rqv8
- https://github.com/vitest-dev/vitest/security/advisories/GHSA-qxg6-89mg-rqv8
Get alerted when CVE-2026-112949 or the next vulnerability affects your stack