ZeroHour

CVE-2026-72717

moderate

Template-literal injection in Orval zod schema generation enables import-time RCE

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

Orval's zod schema generator emits an OpenAPI schema's 'default' value as a module-level JavaScript template literal without escaping backticks or '${', so a crafted default such as 'v${<code>}w' injects a live expression (code injection / improper encoding, CWE-94, CWE-116, CWE-1336). The injected expression is evaluated when the generated zod module is imported, so an attacker who controls or influences the OpenAPI description used at codegen time gains arbitrary code execution in the build/CI pipeline or the application at import, with no further request or function call required; the issue was verified on Orval 8.19.0 and survives default OpenAPI validation. Affected users are npm projects that run Orval to generate zod schemas from third-party or otherwise attacker-influenced OpenAPI specs and then import the generated modules. No in-the-wild exploitation is known, CISA KEV does not list it, EPSS assigns a 0.5% probability of exploitation within 30 days (percentile 44), and no public PoC is known beyond the researcher's reproduction scripts attached to the report; CVSS 4.0 rates it 9.3 (critical).

What to do: Inspect generated Orval zod files for module-level '...Default' template literals containing unescaped backticks or '${', and treat OpenAPI 'default' values as untrusted codegen input; avoid importing zod modules generated from attacker-controlled or third-party specs until you can upgrade to an Orval release that encodes defaults via a proper string-literal encoder (e.g., JSON.stringify or backtick/${ escaping), as the maintainers recommend — no fixed version number was available in the data. Also restrict who can supply or modify the OpenAPI description used in CI codegen, and validate or lint generated output for injected expressions.

Affected
Orval (open-source project; npm package 'orval') Orval zod schema code generation from OpenAPI descriptionsVerified on 8.19.0; affected version range not stated in available data — treat Orval releases that emit zod 'default' values as template literals as potentiall
Estimated exposure
moderate≈10,000–100,000 npm projects plausibly run Orval at codegen time, with the exploitable subset smaller (requires an attacker-influenced spec and import of the… — No install-count or scan data was provided, so this is a rough estimate based on Orval's adoption as a moderately popular npm OpenAPI codegen library and the narrow trigger condition rather than a measured figure.

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 ${...} expression or backtick in a schema 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-w727-8j6c-2rj4 (critical)

In the news

No ingested article mentions this CVE yet.