Vulnerabilities

Security fix · CVE-2026-112949

Vitest is a Vite-native testing framework for JavaScript and TypeScript projects.

Published Oct 20, 2026 · catalog updated Oct 23, 2026 · Vitest is a Vite-native

Last checked Nov 6, 2026. A connected source was read within the last 7 days.

Check if you run it

No confirmed exploitation is on record for CVE-2026-112949. EPSS is 0.34%. Act only if a listed version of Vitest is a Vite-native is installed.

Gaps on this record

  • The stored product name is a package slug. The name on this page is taken from the title (Vitest is a Vite-native).
  • No vendor fix or required action is stored. Compare the linked advisory before you change production.
Severity
Medium4.7
Known exploitation
Not in CISA/VulnCheck KEV
EPSS
0.34%
Remediation
Version ranges on file
Affected products
npm @vitest/mocker · package npm

### Summary 's accepts mock registrations on Vite's dev-server WebSocket with no authentication, and interpolates the mock's 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 ( , PR #10972) hardened only the branch and left the branch reaching the unescaped generator. ### Patches Fixed in 5.0.3, released on 2026-09-30 (PR #11377), and backported to 4.1.12. now serializes the module URL and the export names with , so a registered mock cannot change the generated code. Projects that call or directly need 4.1.12 or 5.0.3. ### Details builds module source by string interpolation: lands inside a double-quoted JavaScript string with no escaping or validation. feeds it straight from the socket: chooses which module is hijacked; is what gets interpolated. The hook ( ) then returns for that id. With a request for is answered with valid, executable JavaScript: ( ) also takes the export-name array from the same socket, and those names are interpolated unescaped too — but each name is emitted into , and , and no payload tested parses in all three positions (all nine candidates were rejected by the parser). It is a hardening gap, not a second usable vector; is the exploited one. **Who can reach the socket.** Vite 8 answers HTTP 400 to any HMR upgrade carrying an header it does not own, so a cross-origin browser page cannot open it — the PoC asserts this for and . The reachable attacker is a non-browser WebSocket client with access to the dev server's port, the same prerequisite under which GHSA-82fw-gwwq-j7x9 was published. ### PoC — (exit 0 = vulnerable), , , . Everything lives under a fresh directory deleted on exit, the dev server binds to on an ephemeral port, no external host is contacted, and the payload is only inspected a

Are you affected?

Enter the version you run. The result uses only the ranges stored on this record.

The check returns affected, not affected, or incomplete. It does not guess a version that is missing from the record.

  • npm @vitest/mocker>= 2.1.0-beta.7, < 4.1.12
  • npm @vitest/mocker>= 5.0.0-beta.1, < 5.0.3
  • package npmversion unspecified

How to fix CVE-2026-112949

What to do

Three questions, each answered from this record only. Confirm the vendor advisory before you patch.

Should you patch?

No confirmed exploitation is on record for CVE-2026-112949. EPSS is 0.34%. Act only if a listed version of Vitest is a Vite-native is installed.

Which versions are affected?

Compare what you have installed with >= 2.1.0-beta.7, < 4.1.12, >= 5.0.0-beta.1, < 5.0.3. Compare the installed version with the linked vendor advisory before you change production.

What should an analyst verify?

CWE-116; CWE-306: Missing Authentication for Critical Function; CWE-94: Code Injection. EPSS 0.34%. There is no CISA KEV listing. No Exploit-DB or Metasploit reference is linked. Use the source links for the original advisory.

Code

The project this record applies to. Exploit listings stay in References.

Timeline

Detection, updates, and resolution for this record.

  1. Oct 20, 2026 · NIST NVD

    Detected

    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 a

  2. Oct 20, 2026 · NIST NVD

    Updated

    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 a

  3. Oct 21, 2026 · GitHub Advisory Database

    Updated

    ### Summary 's accepts mock registrations on Vite's dev-server WebSocket with no authentication, and interpolates the mock's 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 G

  4. Oct 23, 2026 · NIST NVD

    Updated

    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 a

Sources

  • CVE.orgVulnerability recordCVE-2026-112949

    Official CVE identifier

    cve.org
  • FIRST EPSSExploitation probabilityCVE-2026-112949

    30-day exploitation probability 0.34%

    first.org
  • GitHub Advisory DatabasePackage advisoryGHSA-qxg6-89mg-rqv8

    Vitest: Code injection via unauthenticated manual mock registration

    github.com
  • NIST NVDVulnerability recordCVE-2026-112949

    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-contro

    nvd.nist.gov
  • Snyk Vulnerability DatabasePackage advisorySNYK-JS-VITESTMOCKER-21347792

    Arbitrary Code Injection

    security.snyk.io

References

Freshness

Last verified in this catalog Nov 6, 2026. Significant claims (KEV, EPSS, CVSS, affected ranges) come from the source rows above — open the original publisher for the authoritative advisory.

  • FIRST EPSSNov 6, 2026
  • Snyk Vulnerability DatabaseOct 23, 2026
  • NIST NVDOct 23, 2026
  • GitHub Advisory DatabaseOct 22, 2026
  • CVE.orgOct 21, 2026