CVE-2026-62682: Orval Remote Code Execution via Unescaped Server URL in Template Literal
When Orval is told to pull the base URL from your OpenAPI spec, a malicious servers[].url value can break out of the generated JavaScript template literal and execute arbitrary code on any machine…

The problem
Orval's getBaseUrlFromSpecification: true option reads servers[0].url from the OpenAPI spec and writes it directly into a JavaScript template literal in the generated fetch client, with no escaping of backticks or ${ sequences.
An attacker who controls or influences the spec can craft a server URL that contains a backtick. That single character terminates the template literal early, turning the rest of the URL into a live JavaScript expression that executes when the generated request function is called.
Proof of concept
A working proof-of-concept for CVE-2026-62682 in orval, with the exact payload below.
# Malicious OpenAPI servers block
openapi: 3.1.0
info:
title: Pwn
version: 0.0.1
servers:
- url: "http://api.x/`+(globalThis.X=require('fs').writeFileSync('/marker','pwned'))+`"
paths:
/v1/u:
get:
operationId: getUser
responses:
'200':
description: ok
# Orval emits this into the generated client:
# const url = `http://api.x/`+(globalThis.X=require('fs').writeFileSync('/marker','pwned'))+`/v1/u`;
# Calling getUser() writes "/marker" to disk.The root cause is a missing escaping step in the code path that calls getBaseUrlFromSpecification. The spec's servers[0].url string is concatenated directly into a template-literal string during code generation (CWE-94, CWE-116, CWE-1336). A backtick in the URL closes the surrounding template literal, and whatever follows is parsed as executable JavaScript, not string data.
PR #3692 (commit 8ef1bfdf) adds escaping of spec-controlled strings before they are emitted into template literals and object keys. The same commit fixed several related injection sinks across the orval codebase. The pattern mirrors the earlier jsStringEscape approach used to close the MCP/summary injection (CVE-2026-22785).
The fix
Upgrade orval to 8.21.0 or later. The fix (PR #3692, commit 8ef1bfdf3f9bcaf9dabfbe2e42887f1c0e159ab6) escapes backticks and ${ sequences in all spec-controlled strings before they are written into generated template literals. If immediate upgrade is not possible, avoid output.baseUrl.getBaseUrlFromSpecification: true with any spec whose servers[].url field is not fully trusted.
Reported by melloware.
Related research
- criticalCVE-2026-71866CVE-2026-71866: orval Import-time RCE via Zod Object Property Name Injection
- high · 7.1CVE-2026-62680CVE-2026-62680: Orval Generation-Time SSRF and Local File Inclusion via Unvalidated $ref
- high · 8.3CVE-2026-54661CVE-2026-54661: swagger-typescript-api Axios HTTP Client Code Injection via servers[0].url
- high · 8.3CVE-2026-54664CVE-2026-54664: swagger-typescript-api Code Injection via Unescaped Enum Values