ZeroHour

CVE-2026-71867

moderate

Code-injection RCE in orval MSW mock generation via unescaped schema property names

CVSS 4.0
9.3 critical
EPSS
<1%p47
Published
()
Modified
AI analysis

Orval, a tool that generates client code and mocks from OpenAPI specifications, writes each schema property name into generated MSW mock files as a single-quoted object key without escaping single quotes. When a property name contains a single quote, the key terminates early and any bracketed expression the attacker appended is injected into the object literal as a computed property key, which JavaScript evaluates when the generated mock factory is called (for example in unit tests or MSW handlers). An attacker who controls or can influence the OpenAPI specification processed by orval therefore gains arbitrary JavaScript execution in the developer's Node process and, via child_process, operating-system command execution on the machine that runs the generated mocks. Teams using orval with mock generation enabled (output.mock: true) that consume third-party or otherwise attacker-influenced specifications are affected; the flaw was verified against orval 8.19.0 on Node. No public proof-of-concept or in-the-wild exploitation is currently known, and the flaw is not in CISA's KEV catalog, with an EPSS 30-day exploitation probability of about 0.5%.

What to do: Until a patched orval release is available, avoid running or committing MSW mocks generated by orval 8.19.0 from specifications you do not fully control, or pre-validate schema property names to exclude single quotes and bracket characters. Inspect generated mock files for unexpected computed keys (e.g., expressions invoking require or child_process) before executing tests. Track the orval project for a fix that escapes property names as JSON string keys, and upgrade once a fixed version is published.

Affected
orval (open-source npm project) orval (MSW mock generator, output.mock: true)verified on 8.19.0; exact affected and fixed ranges not specified in the source data, but any version that emits unescaped single-quoted property names in gener
Estimated exposure
moderate≈10,000–100,000 developer projects/users based on orval's npm adoption, of which only the subset enabling MSW mock generation on attacker-influenced specs is… — Orval is a widely used but build-time OpenAPI code-generation tool on npm, so the plausible population is on the order of tens of thousands of projects, and exploitation additionally requires generating mocks from a spec containing…

Order-of-magnitude estimate by the model from install counts, market share and public scan data it knows; verify before quoting.

Description

Orval generates type-safe JavaScript clients in TypeScript from OpenAPI v3 and Swagger v2 specifications. Prior to 8.21.0, a single quote in a schema property name is emitted into single-quoted object keys in generated MSW mock factories without safe encoding. This permits attacker-controlled JavaScript to be evaluated when the generated mock factory is called by tests or an MSW handler, resulting in code execution in the developer, CI, test, or application environment. The affected code is packages/core/src/getters/keys.ts function getKey and MSW mock generation. This issue is fixed in version 8.21.0.

Ecosystems
npm
Weakness
CWE-89, CWE-95
Vector
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X
GHSA
GHSA-2w86-xfrc-g85r (critical)

In the news

No ingested article mentions this CVE yet.