Junglewise Threat Intelligence

CVE-2026-62681: Orval code injection via OpenAPI path template literal

CVE-2026-62681 · Severity: critical · CVSS 9.3 · Published 2026-09-03

Executive brief

Orval is a code generator that creates API clients from OpenAPI specifications. When processing OpenAPI paths containing backtick characters, Orval fails to escape them in the generated JavaScript template literals, allowing an attacker to break out of the string context and inject arbitrary code. An attacker who can control or influence the OpenAPI specification (e.g., via a malicious API definition) can execute arbitrary code in the developer's environment, CI/CD pipeline, or running application whenever the generated client is called.

Technical details

The vulnerability is a code injection flaw in Orval's code generation for request URL builders. The generator emits the OpenAPI path directly into a JavaScript template literal (`` `/path` ``) without escaping backticks or `${` sequences. An attacker can craft an OpenAPI specification with a malicious path (e.g., `/users/` + `{backtick}(require("fs").writeFileSync("/marker","pwned"))+{backtick}/list`) that breaks out of the template literal, injects a JavaScript expression, and causes arbitrary code execution. The injected code runs whenever the generated request/URL/key function is invoked. The attack requires the attacker to control or influence the OpenAPI specification being processed; it survives Orval's default validation. Patched in version 8.21.0; the fix involves escaping backticks and `${` in the path before emission into the template literal or using a URL encoder that treats the path as literal data.

Affected products

  • orval-labs orval < 8.21.0

Timeline

  • 2026-09-03: disclosed: GitHub Advisory GHSA-fg9p-mrxr-hvq7 published
  • 2026-09-03: patched: Fix released in Orval 8.21.0

References

Related threats