{"id":"CVE-2026-72716","aliases":["CVE-2026-72716","GHSA-p4cg-3328-rvfg"],"related":[],"kind":"vulnerability","state":"published","title":"Orval: Import-time RCE via query-parameter default -> zod module-level template literal","summary":"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 query 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.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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 query 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.","source":"cvelist"},{"lang":"en","text":"### Summary\n\nOrval's zod schema generation emits the **query-parameter** `default` value as a module-level template literal\n(`export const …Default = `<default>`;`) without escaping `${` or the backtick. A default of the form\n`v${<code>}w` injects a live JavaScript expression evaluated when the generated zod schema module is\nimported, executing attacker-controlled code at import — no request or function call needed. Verified\non Orval 8.19.0; survives default OpenAPI validation.\n\n### Details\n\n```ts\nexport const …Default = `v${globalThis.ORVPWN()}w`;   // ${...} = arbitrary JS expression, runs at import\n```\n\nMalicious input: a query parameter with a `default` of `v${<attacker JS>}w`. `${...}` permits any JS expression.\n\nNote: this is one of several `default`-bearing positions that reach the same unescaped zod\ntemplate-literal sink; a single fix (escape `default` values) closes all of them, and a CNA may choose\nto consolidate the related reports.\n\n### PoC\n\n`reproduce.sh` (+ `make_spec.py`) attached: generates the zod schema with default validation, bundles\nit, imports it, and shows a marker written at import. Verified on 8.19.0.\n\n### Impact\n\nCode execution at import in any application that imports a zod schema module generated from an\nattacker-controlled or attacker-influenced OpenAPI description.\n\n### Suggested fix\n\nEmit `default` values via a proper string-literal encoder (JSON.stringify, or escape backtick and `${`\nif a template literal must be used); never interpolate a spec value into a template literal. Apply to\nevery `default` position.\n[maintainer-report.txt](https://github.com/user-attachments/files/29399067/maintainer-report.txt)\n[make_spec.py](https://github.com/user-attachments/files/29399068/make_spec.py)\n[reproduce.sh](https://github.com/user-attachments/files/29399069/reproduce.sh)","format":"markdown","source":"ghsa"}],"published":"2026-08-19T17:33:01.745Z","modified":"2026-09-09T21:20:38.860Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:4.0","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","score":9.3,"rating":"CRITICAL"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:4.0","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","score":9.3,"rating":"CRITICAL"},{"scorer":"GitHub","scheme":"CVSS:4.0","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","rating":"CRITICAL"}],"cwes":["CWE-1336"],"affected":[{"ranges":[{"version":"< 8.21.0","status":"affected"}],"vendor":"orval-labs","product":"orval","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"8.21.0"}],"ecosystem":"npm","package":"orval","purl":"pkg:npm/orval","source":"ghsa"}],"references":[{"url":"https://github.com/orval-labs/orval/security/advisories/GHSA-p4cg-3328-rvfg","tags":["exploit","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/orval-labs/orval/pull/3692","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/orval-labs/orval/commit/8ef1bfdf3f9bcaf9dabfbe2e42887f1c0e159ab6","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/orval-labs/orval/releases/tag/v8.21.0","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-72716","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/orval-labs/orval","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"yes","technicalImpact":"total","date":"2026-08-19T17:48:07.984Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-72716","url":"https://www.cve.org/CVERecord?id=CVE-2026-72716","licence":"CVE Terms of Use","modified":"2026-08-19T17:48:14.929Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-p4cg-3328-rvfg","url":"https://github.com/advisories/GHSA-p4cg-3328-rvfg","licence":"CC-BY-4.0","modified":"2026-09-02T15:00:09.983Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-72716","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-72716","licence":"Public domain","modified":"2026-09-09T21:20:38.860Z"}],"updatedAt":"2026-11-25T22:59:33.997Z","epss":{"score":0.00664,"percentile":0.52999,"date":"2026-12-01T12:00:22.000Z"}}