ZeroHour

CVE-2026-71869

large

Import-time RCE via unescaped template literal in Orval zod schema generation

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

Orval's zod schema generator writes array-item default values taken from an OpenAPI description directly into a module-level JavaScript template literal without escaping backticks or dollar-brace sequences, so a crafted default value injects a live JavaScript expression into the generated module (CWE-94, CWE-116, CWE-1336). The injected expression executes when the generated zod schema module is imported, so no network request, function call, privileges, or user interaction is required beyond the application loading the generated code. An attacker who controls or can influence the OpenAPI specification used for generation therefore gains arbitrary code execution in the importing process, consistent with the critical CVSS 4.0 score of 9.3 with high confidentiality, integrity, and availability impact. Affected users are npm projects that generate zod schemas with Orval (verified on version 8.19.0) and import those generated modules from attacker-controlled or attacker-influenced specs; the reporter notes several other default-value positions reach the same unescaped sink and one escaping fix is expected to cover all of them. There is no known public proof-of-concept release, the issue is not in CISA KEV, and EPSS estimates about a 0.5% chance of exploitation within 30 days (40th percentile), although the researcher's reproduce.sh demonstrates a marker file being written at import time on 8.19.0.

What to do: Treat Orval's zod output as vulnerable until a patched release is published (no fixed version is stated in the available data), then upgrade Orval and regenerate all zod schema modules. In the interim, audit the OpenAPI descriptions you feed to Orval for default values containing backticks or dollar-brace sequences and scrub or escape them, or post-process generated files so defaults are emitted through a proper string encoder such as JSON.stringify. Watch the maintainer advisory closely, since the CNA may consolidate several related default-injection reports into a single fix.

Affected
Orval (orval package on npm) Orval OpenAPI-to-TypeScript/zod code generator (zod schema generation)verified on 8.19.0; full affected version range not specified in the available data
Estimated exposure
largeon the order of 10^5-10^6 npm users/projects — Orval is a widely adopted npm OpenAPI code generator whose weekly download volume is plausibly in the hundreds of thousands, though genuinely exploitable exposure is limited to projects that import generated zod modules built from…

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 an array item 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-2h9g-j24r-h63g (critical)

In the news

No ingested article mentions this CVE yet.