CVE-2026-71871
moderateImport-time RCE in Orval via unescaped OpenAPI defaults in generated zod schemas
Orval, an npm code generator that turns OpenAPI specifications into client code and zod schemas, interpolates a header parameter's `default` value verbatim into a module-level JavaScript template literal in the generated zod module, without escaping backticks or `${`. An attacker who controls or can influence the OpenAPI description (for example a third-party, partner-supplied, or user-updated API spec) can embed a live expression in a default value such as `v${someCall()}w`, and the injected code runs the moment the generated module is imported — no HTTP request or function call is needed. Successful exploitation yields arbitrary JavaScript execution with the privileges of the process importing the generated code, i.e. code execution in the application or in the build/CI pipeline. Any project using Orval (verified on version 8.19.0) to generate and import zod schemas from specifications that are not fully trusted is affected. No in-the-wild exploitation, public PoC, or KEV listing is known; EPSS assigns a roughly 0.5% probability of exploitation within 30 days.
What to do: Watch Orval's npm releases/changelog for a patched version that escapes `default` values (the suggested fix emits defaults via JSON.stringify, or escapes backticks and `${` if a template literal is kept) and upgrade as soon as it is available, since no fixed version is stated in this data. In the meantime, treat OpenAPI specifications as untrusted input and review generated zod modules for unescaped `${` or backticks interpolated from spec defaults — the same sink is reachable from several `default`-bearing positions, not just header parameters. After upgrading, regenerate all zod schemas and rebuild/redeploy affected bundles to remove any previously injected defaults.
| Orval project (npm package 'orval') Orval — OpenAPI-to-zod schema generator | 8.19.0 verified; no fixed version stated in the source data — treat current releases as affected until a patched version is announced |
Order-of-magnitude estimate by the model from install counts, market share and public scan data it knows; verify before quoting.
Orval generates type-safe JavaScript clients in TypeScript from OpenAPI v3 and Swagger v2 specifications. Prior to 8.21.0, a ${...} expression or backtick in a header parameter default is emitted into a module-level template literal emitted by zod schema generation without safe encoding. This permits attacker-controlled JavaScript to be evaluated when the generated zod schema module is imported, resulting in code execution in the developer, CI, test, or application environment. The affected code is packages/zod/src/index.ts function formatDefaultValue. This issue is fixed in version 8.21.0.
- Ecosystems
- npm
- Weakness
- CWE-94, CWE-116, CWE-1336
- 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-8j6p-r8jg-mxqh (critical)
In the news0 stories
No ingested article mentions this CVE yet.