{"id":"CVE-2026-71871","aliases":["EUVD-2026-62601","GHSA-8j6p-r8jg-mxqh","ROOT-APP-NPM-CVE-2026-71871"],"status":"published","title":"Orval: Import-time RCE via header-parameter default -\u003e zod module-level template literal","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 header 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.","severity":{"version":"4.0","score":9.3,"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","level":"critical","assessor":"cna","from":"cve"},"epss":{"day":"2026-11-09","score":0.00653,"percentile":0.51573,"model":"v2026.06.15"},"facts":{"in_kev":false,"known_exploited":false,"public_exploit":false,"fix_available":true},"cwes":["CWE-116","CWE-1336","CWE-94"],"published":"2026-08-19T17:33:56Z","modified":"2026-10-28T02:30:25Z","fixes":[{"ecosystem":"npm","package":"orval","fixed_in":["8.21.0"],"sources":["ghsa","osv"]},{"ecosystem":"Root:npm","package":"orval","fixed_in":["7.21.0-aikido.5","7.13.2-aikido.2","7.13.2-aikido.1","7.13.2-aikido.3"],"sources":["osv"]},{"ecosystem":"Root:npm","package":"@rootio/orval","fixed_in":["7.21.0-root.io.5","7.13.2-root.io.2","7.13.2-root.io.1","7.13.2-root.io.3"],"sources":["osv"]}],"affected":[{"source":"ghsa","ecosystem":"npm","package":"orval","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"8.21.0"}]}]},{"source":"osv","ecosystem":"npm","package":"orval","ranges":[{"type":"SEMVER","events":[{"introduced":"0"},{"fixed":"8.21.0"}]}]},{"source":"osv","ecosystem":"Root:npm","package":"orval","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"7.21.0-aikido.5"},{"fixed":"7.13.2-aikido.2"},{"fixed":"7.13.2-aikido.1"},{"fixed":"7.13.2-aikido.3"}]}]},{"source":"osv","ecosystem":"Root:npm","package":"@rootio/orval","ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"7.21.0-root.io.5"},{"fixed":"7.13.2-root.io.2"},{"fixed":"7.13.2-root.io.1"},{"fixed":"7.13.2-root.io.3"}]}]}],"products":[{"vendor":"orval-labs","product":"orval"}],"references":[{"url":"https://github.com/orval-labs/orval/security/advisories/GHSA-8j6p-r8jg-mxqh","tags":["x_refsource_CONFIRM","advisory","web"]},{"url":"https://github.com/orval-labs/orval/pull/3692","tags":["x_refsource_MISC","fix","web"]},{"url":"https://github.com/orval-labs/orval/commit/8ef1bfdf3f9bcaf9dabfbe2e42887f1c0e159ab6","tags":["x_refsource_MISC","fix","web"]},{"url":"https://github.com/orval-labs/orval/releases/tag/v8.21.0","tags":["x_refsource_MISC","web"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-71871","tags":["advisory"]},{"url":"https://github.com/advisories/GHSA-8j6p-r8jg-mxqh"},{"url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/71xxx/CVE-2026-71871.json","tags":["advisory"]},{"url":"https://github.com/orval-labs/orval","tags":["package"]}],"sources":{"cve":[{"id":"CVE-2026-71871","title":"Orval: Import-time RCE via header-parameter default -\u003e zod module-level template literal","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 header 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.","status":"published","published":"2026-08-19T17:33:56.011Z","modified":"2026-08-21T21:49:37.465Z","cvss":[{"version":"4.0","score":9.3,"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","level":"critical","assessor":"cna"}],"cwes":["CWE-94","CWE-116","CWE-1336"],"updated_at":"2026-11-02T14:19:49.559463Z"}],"euvd":[{"id":"EUVD-2026-62601","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 header 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.","status":"published","published":"2026-08-19T17:33:56Z","modified":"2026-08-21T21:49:37Z","cvss":[{"version":"4.0","score":9.3,"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","level":"critical"}],"updated_at":"2026-11-02T18:01:36.505605Z"}],"ghsa":[{"id":"GHSA-8j6p-r8jg-mxqh","title":"Orval: Import-time RCE via header-parameter default -\u003e zod module-level template literal","description":"### Summary\n\nOrval's zod schema generation emits the **header-parameter** `default` value as a module-level template literal (`export const Default = `\u003cdefault\u003e`;`) without escaping `${` or the backtick. A default of the form `v${\u003ccode\u003e}w` injects a live JavaScript expression 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 …Default = `v${globalThis.ORVPWN()}w`;   // ${...} = arbitrary JS expression, runs at import\n```\n\nMalicious input: a header parameter with a `default` of `v${\u003cattacker JS\u003e}w`. `${...}` permits any JS expression.\n\nNote: this is one of several `default`-bearing positions that reach the same unescaped zod template-literal sink; a single fix (escape `default` values) closes all of them, and a CNA may choose to consolidate the related reports.\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. Apply to every `default` position. [make_spec.py](https://github.com/user-attachments/files/29399137/make_spec.py) [reproduce.sh](https://github.com/user-attachments/files/29399138/reproduce.sh)","status":"published","published":"2026-09-03T18:32:03Z","modified":"2026-09-03T18:32:07Z","cvss":[{"version":"4.0","score":9.3,"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","level":"critical"}],"cwes":["CWE-94","CWE-116","CWE-1336"],"updated_at":"2026-11-02T14:41:11.621873Z"}],"nvd":[{"id":"CVE-2026-71871","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 header 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.","status":"published","published":"2026-08-19T18:17:24.68Z","modified":"2026-09-09T21:20:38.86Z","cvss":[{"version":"4.0","score":9.3,"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","level":"critical","assessor":"secondary"}],"cwes":["CWE-94","CWE-116","CWE-1336"],"updated_at":"2026-11-02T14:12:39.962615Z"}],"osv":[{"id":"CVE-2026-71871","title":"Orval: Import-time RCE via header-parameter default -\u003e zod module-level template literal","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 header 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.","status":"published","published":"2026-08-19T17:33:56.011Z","modified":"2026-10-28T02:30:25.448097865Z","cvss":[{"version":"4.0","score":9.3,"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","level":"critical"}],"cwes":["CWE-116","CWE-1336","CWE-94"],"updated_at":"2026-11-02T15:45:15.511448Z"},{"id":"GHSA-8j6p-r8jg-mxqh","title":"Orval: Import-time RCE via header-parameter default -\u003e zod module-level template literal","description":"### Summary\n\nOrval's zod schema generation emits the **header-parameter** `default` value as a module-level template literal (`export const Default = `\u003cdefault\u003e`;`) without escaping `${` or the backtick. A default of the form `v${\u003ccode\u003e}w` injects a live JavaScript expression 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 …Default = `v${globalThis.ORVPWN()}w`;   // ${...} = arbitrary JS expression, runs at import\n```\n\nMalicious input: a header parameter with a `default` of `v${\u003cattacker JS\u003e}w`. `${...}` permits any JS expression.\n\nNote: this is one of several `default`-bearing positions that reach the same unescaped zod template-literal sink; a single fix (escape `default` values) closes all of them, and a CNA may choose to consolidate the related reports.\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. Apply to every `default` position. [make_spec.py](https://github.com/user-attachments/files/29399137/make_spec.py) [reproduce.sh](https://github.com/user-attachments/files/29399138/reproduce.sh)","status":"published","published":"2026-09-03T18:32:03Z","modified":"2026-09-03T18:45:04.041323244Z","cvss":[{"version":"4.0","score":9.3,"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","level":"critical"}],"cwes":["CWE-116","CWE-1336","CWE-94"],"updated_at":"2026-11-02T15:46:42.437513Z"},{"id":"ROOT-APP-NPM-CVE-2026-71871","title":"CVE-2026-71871 in orval - Patched by Root","description":"Root has patched CVE-2026-71871 in the orval package for Root:npm. Multiple fixed versions available.","status":"published","published":"2026-09-21T06:43:17Z","modified":"2026-09-21T07:15:06.410534035Z","updated_at":"2026-11-02T15:53:27.649662Z"}]}}
