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

Source: https://junglewise.ai/threats/cve-2026-62681-orval-code-injection-via-openapi-path-template-literal  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-08-19. Updated: 2026-09-25  
License: CC BY 4.0 with a link back

CVE-2026-62681 · Severity: critical · CVSS 4 · Published 2026-08-19

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.

Technologies: [orval (npm)](https://junglewise.ai/threats/technologies/orval). Vendors: [npm](https://junglewise.ai/threats/vendors/npm).

## Quick answers

**Is CVE-2026-62681 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2026-62681 being exploited in the wild.

**How severe is CVE-2026-62681?** Critical severity, with a CVSS score of 4, published 19 August 2026.

**Which products and versions are affected?** orval (npm) < 8.21.0, SEMVER:introduced=0,fixed=8.21.0.

**Is there a fix for CVE-2026-62681?** Yes. orval (npm): upgrade to 8.21.0 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2026-62681 attacked?** It is attacked over the network, in a software library.

**Am I affected by CVE-2026-62681?** Check whether you run orval (npm) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## How to fix

- orval (npm): upgrade to 8.21.0 or later

  ```sh
  npm install orval@8.21.0
  ```


## 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

## Identifiers

- CVE-2026-62681
- GHSA-fg9p-mrxr-hvq7

## Timeline

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

## References

- [https://api.github.com/users/Gal3m](https://api.github.com/users/Gal3m)
- [https://github.com/Gal3m](https://github.com/Gal3m)
- [https://api.github.com/users/Gal3m/gists%7B/gist_id%7D](https://api.github.com/users/Gal3m/gists%7B/gist_id%7D)
- [https://api.github.com/users/Gal3m/repos](https://api.github.com/users/Gal3m/repos)
- [https://avatars.githubusercontent.com/u/91008976?v=4](https://avatars.githubusercontent.com/u/91008976?v=4)
- [https://api.github.com/users/Gal3m/events%7B/privacy%7D](https://api.github.com/users/Gal3m/events%7B/privacy%7D)

## Related threats

- [Orval zod schema code injection via unescaped default value](https://junglewise.ai/threats/cve-2026-72717-orval-zod-schema-code-injection-via-unescaped-default-value)
- [Orval code generation RCE via unescaped template literals in zod schema](https://junglewise.ai/threats/cve-2026-72716-orval-code-generation-rce-via-unescaped-template-literals-in-zod)
- [Orval code injection in zod schema generation](https://junglewise.ai/threats/cve-2026-71871-orval-code-injection-in-zod-schema-generation)
- [Orval code injection in zod schema generation via unescaped template literals](https://junglewise.ai/threats/cve-2026-71869-orval-code-injection-in-zod-schema-generation-via-template)
- [Orval zod code injection via unescaped template literal in default values](https://junglewise.ai/threats/cve-2026-71868-orval-template-literal-injection-in-zod-schema-defaults)
