Advisory Database
  • Advisories
  • Dependency Scanning
  1. npm
  2. ›
  3. @vitest/mocker
  4. ›
  5. CVE-2026-112949

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

October 21, 2026

@vitest/mocker’s interceptorPlugin accepts mock registrations on Vite’s dev-server WebSocket with no authentication, and interpolates the mock’s url into generated module source without escaping. A client that can reach the dev server can make it serve arbitrary JavaScript in place of any project module, which then runs in the developer’s browser on the dev-server origin.

Same handler and same unauthenticated caller as GHSA-82fw-gwwq-j7x9; that fix (8ff9b9a9efca7c6cfd5243569440de8d7a33aec4, PR #10972) hardened only the redirect branch and left the manual branch reaching the unescaped generator.

References

  • github.com/advisories/GHSA-qxg6-89mg-rqv8
  • github.com/vitest-dev/vitest/commit/15cc006aa9f8683dc5f7e895d011fa7dc751ce35
  • github.com/vitest-dev/vitest/commit/b825313243dc55757e8d7c0f9e7a792135e13473
  • github.com/vitest-dev/vitest/releases/tag/v4.1.12
  • github.com/vitest-dev/vitest/releases/tag/v5.0.3
  • github.com/vitest-dev/vitest/security/advisories/GHSA-qxg6-89mg-rqv8
  • nvd.nist.gov/vuln/detail/CVE-2026-112949

Code Behaviors & Features

Detect and mitigate CVE-2026-112949 with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Dependency Scanning using SBOM also detects vulnerabilities from proprietary advisories that this site does not include. Learn more about Dependency Scanning using SBOM →

Affected versions

All versions starting from 2.1.0-beta.7 before 4.1.12, all versions starting from 5.0.0-beta.1 before 5.0.3

Fixed versions

  • 4.1.12
  • 5.0.3

Solution

Upgrade to versions 4.1.12, 5.0.3 or above.

Impact 4.7 MEDIUM

CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:C/C:L/I:L/A:N

Learn more about CVSS

Weakness

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

Source file

npm/@vitest/mocker/CVE-2026-112949.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Thu, 22 Oct 2026 00:16:02 +0000.