{"id":"CVE-2026-72717","aliases":["CVE-2026-72717","GHSA-w727-8j6c-2rj4"],"related":[],"kind":"vulnerability","state":"published","title":"Orval: Import-time RCE via schema 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 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.","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 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.","source":"cvelist"},{"lang":"en","text":"### Summary\n\nOrval's zod schema generation emits a schema's `default` value as a module-level template literal (`export const …Default = `<default>`;`) without escaping `${` or the backtick. A default of the form `v${<code>}w` injects a live JavaScript expression that is evaluated when the generated zod schema module is imported, executing attacker-controlled code at import — no request or function call needed. Verified on Orval 8.19.0; survives default OpenAPI validation.\n\n### Details\n\n```ts\nexport const getIResponseDsDefault = `v${globalThis.ORVPWN()}w`;\n```\n\n`${...}` permits an arbitrary JS expression. Orval escapes its other value sinks (enum, mock, regex, object-default values) with `\\'` inside single-quoted strings; the string `default` is the one value emitted as a backtick template literal, so `${...}`/backtick are interpreted, not escaped. Distinct from the URL-template-literal cases (different field and sink) and from the published Orval CVEs (summary/MCP, x-enumDescriptions, const/mock).\n\n### PoC\n\n`reproduce.sh` (+ `make_spec.py`) attached: generates the zod schema with default validation, bundles it, 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 attacker-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 ${ if a template literal must be used); never interpolate a spec value into a template literal. \n\n[maintainer-report.txt](https://github.com/user-attachments/files/29399048/maintainer-report.txt)\n[make_spec.py](https://github.com/user-attachments/files/29399049/make_spec.py)\n[reproduce.sh](https://github.com/user-attachments/files/29399050/reproduce.sh)","format":"markdown","source":"ghsa"}],"published":"2026-08-19T17:39:23.125Z","modified":"2026-09-18T05:30:05.771Z","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-94","CWE-116","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-w727-8j6c-2rj4","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-72717","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-21T19:44:08.757Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-72717","url":"https://www.cve.org/CVERecord?id=CVE-2026-72717","licence":"CVE Terms of Use","modified":"2026-08-21T19:44:34.681Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-w727-8j6c-2rj4","url":"https://github.com/advisories/GHSA-w727-8j6c-2rj4","licence":"CC-BY-4.0","modified":"2026-09-18T05:30:05.771Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-72717","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-72717","licence":"Public domain","modified":"2026-09-09T21:20:38.860Z"}],"updatedAt":"2026-11-25T22:59:33.998Z","epss":{"score":0.00664,"percentile":0.52999,"date":"2026-12-01T12:00:22.000Z"}}