Vitest: Code injection via unauthenticated manual mock registration (vitest-dev vitest)

CVE-2026-112949
MEDIUM 4.7

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

Scores

VersionScoreVectorScored by
CVSS 3.1MEDIUM 4.7CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:NGitHub_M
CVSS 3.1MEDIUM 4.7CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:NNVD · security-advisories@github.com (Secondary)

Advisories

European references

Affected products

ProductAffected 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

SourceLicence
CVE List (CVEProject cvelistV5)CVE Program Terms of Use
EPSS (FIRST.org)FIRST — attribution requested
ENISA EUVDENISA — reproduction authorised, source acknowledged
NVD (NIST) via fkie-cad/nvd-json-data-feedsPublic domain — this product uses data from the NVD API but is not endorsed or certified by the NVD