{"id":"CVE-2026-24132","aliases":["CVE-2026-24132","GHSA-f456-rf33-4626"],"related":[],"kind":"vulnerability","state":"published","title":"Orval Mock Generation Code Injection via const","summary":"Orval generates type-safe JS clients (TypeScript) from any valid OpenAPI v3 or Swagger v2 specification. Versions \n7.19.0 and below and 8.0.0-rc.0 through 8.0.2 allow untrusted OpenAPI specifications to inject arbitrary TypeScript/JavaScript into generated mock files via the const keyword on schema properties. These const values are interpolated into the mock scalar generator (getMockScalar in packages/mock/src/faker/getters/scalar.ts) without proper escaping or type-safe serialization, which results in attacker-controlled code being emitted into both interface definitions and faker/MSW handlers. The vulnerability is similar in impact to the previously reported enum x-enumDescriptions (GHSA-h526-wf6g-67jv), but it affects a different code path in the faker-based mock generator rather than @orval/core. The issue has been fixed in versions 7.20.0 and 8.0.3.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Orval generates type-safe JS clients (TypeScript) from any valid OpenAPI v3 or Swagger v2 specification. Versions \n7.19.0 and below and 8.0.0-rc.0 through 8.0.2 allow untrusted OpenAPI specifications to inject arbitrary TypeScript/JavaScript into generated mock files via the const keyword on schema properties. These const values are interpolated into the mock scalar generator (getMockScalar in packages/mock/src/faker/getters/scalar.ts) without proper escaping or type-safe serialization, which results in attacker-controlled code being emitted into both interface definitions and faker/MSW handlers. The vulnerability is similar in impact to the previously reported enum x-enumDescriptions (GHSA-h526-wf6g-67jv), but it affects a different code path in the faker-based mock generator rather than @orval/core. The issue has been fixed in versions 7.20.0 and 8.0.3.","source":"cvelist"},{"lang":"en","text":"I am reporting a code injection vulnerability in Orval’s mock generation pipeline affecting @orval/mock in both the 7.x and 8.x series. This issue is related in impact to the previously reported enum x-enumDescriptions (https://github.com/advisories/GHSA-h526-wf6g-67jv), but it affects a different code path in the faker-based mock generator rather than @orval/core.\n\nThe vulnerability allows untrusted OpenAPI specifications to inject arbitrary TypeScript/JavaScript into generated mock files via the const keyword on schema properties. These const values are interpolated into the mock scalar generator (getMockScalar in packages/mock/src/faker/getters/scalar.ts) without proper escaping or type-safe serialization, which results in attacker-controlled code being emitted into both interface definitions and faker/MSW handlers. I have confirmed that this occurs on orval@7.19.0 and orval@8.0.2 with mock: true, and that the generated mocks contain executable payloads such as require('child_process').execSync('id') in the output TypeScript.\n\n```yaml\nopenapi: 3.1.0\ninfo:\n  title: Mock Const Injection PoC\n  version: 1.0.0\npaths:\n  /test:\n    get:\n      operationId: getTests\n      responses:\n        '200':\n          description: OK\n          content:\n            application/json:\n              schema:\n                $ref: '#/components/schemas/Tests'\ncomponents:\n  schemas:\n    Tests:\n      type: object\n      properties:\n        EvilString:\n          type: string\n          const: \"'); require('child_process').execSync('id'); //\"\n        EvilNumber:\n          type: number\n          const: \"0); require('child_process').execSync('id'); //\"\n        SafeEnum:\n          type: string\n          enum: [\"test\"]\n\n```","format":"markdown","source":"ghsa"},{"lang":"es","text":"Orval genera clientes JS con seguridad de tipos (TypeScript) a partir de cualquier especificación OpenAPI v3 o Swagger v2 válida. Las versiones 7.19.0 e inferiores y de la 8.0.0-rc.0 a la 8.0.2 permiten que especificaciones OpenAPI no confiables inyecten TypeScript/JavaScript arbitrario en archivos mock generados a través de la palabra clave const en las propiedades del esquema. Estos valores const se interpolan en el generador escalar mock (getMockScalar en packages/mock/src/faker/getters/scalar.ts) sin un escape adecuado o serialización con seguridad de tipos, lo que resulta en código controlado por el atacante siendo emitido tanto en las definiciones de interfaz como en los manejadores de faker/MSW. La vulnerabilidad es similar en impacto a la previamente reportada enum x-enumDescriptions (GHSA-h526-wf6g-67jv), pero afecta una ruta de código diferente en el generador mock basado en faker en lugar de @orval/core. El problema ha sido solucionado en las versiones 7.20.0 y 8.0.3.","source":"nvd"}],"published":"2026-01-22T18:09:13.000Z","modified":"2026-06-17T10:22:40.997Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","score":7.7,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","score":7.7,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N","rating":"HIGH"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H","score":9.8,"rating":"CRITICAL"}],"cwes":["CWE-77","CWE-94"],"affected":[{"ranges":[{"version":"< 7.20.0","status":"affected"},{"version":">= 8.0.0-rc.0, < 8.0.3","status":"affected"}],"vendor":"orval-labs","product":"orval","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"7.20.0"}],"ecosystem":"npm","package":"@orval/mock","purl":"pkg:npm/%40orval/mock","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"8.0.0-rc.0","status":"affected","fixed":"8.0.3"}],"ecosystem":"npm","package":"@orval/mock","purl":"pkg:npm/%40orval/mock","source":"ghsa"},{"ranges":[{"status":"affected","introduced":"6.0.0","fixed":"7.20.0"},{"status":"affected","introduced":"8.0.0","fixed":"8.0.3"}],"vendor":"orval","product":"orval","cpe":"cpe:2.3:a:orval:orval:*:*:*:*:*:*:*:*","source":"nvd"}],"references":[{"url":"https://github.com/orval-labs/orval/security/advisories/GHSA-f456-rf33-4626","tags":["vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/orval-labs/orval/pull/2828","tags":["issue-tracking","patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/orval-labs/orval/pull/2829","tags":["issue-tracking","patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/orval-labs/orval/pull/2830","tags":["issue-tracking","patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/orval-labs/orval/commit/44ca8c1f5f930a3e4cefb6b79b38bcde7f8532a5","tags":["patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/orval-labs/orval/commit/6d8ece07ccb80693ad43edabccb3957aceadcd06","tags":["patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/orval-labs/orval/commit/9b211cddc9f009f8a671e4ac5c6cb72cd8646b62","tags":["patch","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/orval-labs/orval/releases/tag/v7.20.0","tags":["product","release-notes","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/orval-labs/orval/releases/tag/v8.0.3","tags":["product","release-notes","web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-24132","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/orval-labs/orval","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"total","date":"2026-01-23T20:00:52.884Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-24132","url":"https://www.cve.org/CVERecord?id=CVE-2026-24132","licence":"CVE Terms of Use","modified":"2026-01-23T20:01:12.356Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-f456-rf33-4626","url":"https://github.com/advisories/GHSA-f456-rf33-4626","licence":"CC-BY-4.0","modified":"2026-02-28T06:27:01.410Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-24132","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-24132","licence":"Public domain","modified":"2026-06-17T10:22:40.997Z"}],"updatedAt":"2026-11-25T22:59:13.090Z","epss":{"score":0.00743,"percentile":0.55913,"date":"2026-12-01T12:00:22.000Z"}}