Vitest: Code injection via unauthenticated manual mock registration (vitest-dev vitest)
At a glance
- Source
- NVD
- EPSS
- EPSS 0.34 % · percentile 29 ()
- State
- PUBLISHED
- Published
- Updated
- Assigner
- GitHub_M
- Affected products
- vitest-dev · vitest
@vitest · mocker - NVD status
- Awaiting Analysis
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.
Weaknesses (CWE)
- CWE-94 — Improper Control of Generation of Code
- CWE-116 — Improper Encoding or Escaping of Output
- CWE-306 — Missing Authentication for Critical Functionality
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
Scores
| Version | Score | Vector | Scored by |
|---|---|---|---|
| CVSS 3.1 | MEDIUM 4.7 | CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:N | GitHub_M |
| CVSS 3.1 | MEDIUM 4.7 | CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:N | NVD · security-advisories@github.com (Secondary) |
Advisories
- GHSA-qxg6-89mg-rqv8 — Vitest: Code injection via unauthenticated manual mock registration
European references
- ENISA EUVD · EUVD-2026-105148
- GCVE · GCVE-0-2026-112949
Affected products
| Product | Affected versions |
|---|---|
| vitest-dev · vitest | affected : >= 2.1.0-beta.7, < 4.1.12 affected : >= 5.0.0, < 5.0.3 |
| @vitest · mocker | affected : >= 2.1.0-beta.7, < 4.1.12 affected : >= 5.0.0, < 5.0.3 |
Sources
| Source | Licence |
|---|---|
| CVE List (CVEProject cvelistV5) | CVE Program Terms of Use |
| EPSS (FIRST.org) | FIRST — attribution requested |
| ENISA EUVD | ENISA — reproduction authorised, source acknowledged |
| NVD (NIST) via fkie-cad/nvd-json-data-feeds | Public domain — this product uses data from the NVD API but is not endorsed or certified by the NVD |