ZeroHour

CVE-2026-62682

Template-literal injection RCE in Orval generated clients via unescaped server URL

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

Orval, an npm code generator that produces API clients from OpenAPI specifications, embeds the spec's servers[0].url into the generated request-URL template literal without escaping when output.baseUrl.getBaseUrlFromSpecification is set to true. A server URL containing a backtick (or template syntax) breaks out of the template literal and injects an arbitrary JavaScript expression that is evaluated at runtime whenever the generated request function is called, and the flaw survives Orval's default OpenAPI validation; it was verified on Orval 8.19.0 with the fetch client. An attacker who controls or influences the OpenAPI document (e.g., a third-party or imported spec) therefore gains arbitrary code execution in any process that invokes the generated client, with high confidentiality, integrity, and availability impact per the CVSS 4.0 score of 9.3 (critical). Affected users are teams running Orval with the getBaseUrlFromSpecification option enabled, both in build environments and in the downstream applications whose generated clients call the injected code. No public exploit or in-the-wild exploitation is known; it is not in CISA KEV and EPSS estimates only a ~0.5% probability of exploitation within 30 days (41st percentile).

What to do: Until a patched Orval release is available, avoid setting output.baseUrl.getBaseUrlFromSpecification to true (hard-code the base URL instead) or sanitize the OpenAPI servers[].url by stripping backticks and ${ sequences before running the generator. Audit already-generated clients for unescaped backtick-derived template literals originating from server URLs, and treat externally sourced OpenAPI documents as untrusted input. Monitor the Orval project for a fix that escapes backticks and ${ in emitted URL template literals, and upgrade when published.

Affected
Orval (npm package) Orval OpenAPI client generatorVerified affected on 8.19.0 (fetch client) when output.baseUrl.getBaseUrlFromSpecification is true; affected version range and fixed version not stated in the s
Estimated exposure
unknown; plausibly limited to the subset of Orval users who enable the non-default getBaseUrlFromSpecification option and generate clients from third-party or… — No npm download counts, active-install metrics, or internet-exposure scan data were provided, and deployment patterns further narrow exposure because the vulnerable code path requires a non-default configuration option plus an…

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, an unescaped backtick in servers[0].url is emitted into request URL template literals generated when output.baseUrl.getBaseUrlFromSpecification is enabled without safe encoding. This permits attacker-controlled JavaScript to be evaluated when a generated request or URL-builder function is called, resulting in code execution in the developer, CI, test, or application environment. The affected code is packages/core/src/getters/route.ts function getFullRoute. 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-88f2-fpv8-89q2 (critical)

In the news

No ingested article mentions this CVE yet.