CVE-2026-112949

Vitest: Code injection via unauthenticated manual mock registration

State
Published
Severity
4.7 Medium
Published
Oct 20, 2026
Updated
Oct 23, 2026
Reserved
Oct 19, 2026

Read the record on cve.org

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.

Scores

CVSSScoreVectorSource
3.14.7 MediumCVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:NGitHub_M

Weaknesses

  • CWE-94 Improper Control of Generation of Code ('Code Injection')
  • CWE-116 Improper Encoding or Escaping of Output
  • CWE-306 Missing Authentication for Critical Function

Affected Products

ProductVersions
vitestvitest-dev
  • >= 2.1.0-beta.7, < 4.1.12Affected
  • >= 5.0.0, < 5.0.3Affected
mocker@vitest
  • >= 2.1.0-beta.7, < 4.1.12Affected
  • >= 5.0.0, < 5.0.3Affected

References

Every record here comes from the CVE Program’s CVE List. © 1999–2026 The MITRE Corporation. CVE is a registered trademark of The MITRE Corporation. The records are reproduced under the CVE Program terms of use.