CVE-2026-71868
nicheImport-time code execution in Orval via unescaped enum defaults in generated zod schemas
Orval, an npm tool that generates API clients and zod schemas from OpenAPI descriptions, writes enum-typed 'default' values into generated code as raw module-level template literals without escaping backticks or the ${ sequence. An attacker who controls or influences an OpenAPI specification can set an enum-typed property's default to something like v${<arbitrary JavaScript>}w, so the injected expression is evaluated the moment the generated zod schema module is imported, yielding arbitrary code execution with no request or function call required. The flaw survives Orval's default OpenAPI validation and was verified on version 8.19.0; the vendor notes that a single fix that properly escapes all default values closes every path to the same sink. Any project that generates zod schemas with Orval from an attacker-controlled or attacker-influenced OpenAPI description and imports the generated module is affected. The flaw is rated critical (CVSS 4.0: 9.3); no in-the-wild exploitation or public PoC is known, and EPSS assigns about a 0.5% probability of exploitation within 30 days.
What to do: Until a patched release ships (fixed version not stated in the available data), avoid running Orval against untrusted OpenAPI descriptions, strip backticks and ${ sequences from enum default values, and treat generated zod modules as untrusted code when imported. When a fix is released, upgrade, regenerate all zod schemas, and audit existing generated modules for default values interpolated into template literals; the vendor notes one escape-all-defaults fix closes all affected code paths.
| Orval project orval (npm) | 8.19.0 confirmed vulnerable; exact affected version range not specified in the available data (versions that interpolate enum-typed default values into zod temp |
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 an enum 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-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-3575-w9fc-c2j6 (critical)
In the news0 stories
No ingested article mentions this CVE yet.