Orval Overload: From OpenAPI Spec to Remote Code Execution
Vulnerability ID: CVE-2026-22785
CVSS Score: 9.3
Published: 2026-01-12
A critical code injection vulnerability in the orval TypeScript client generator allows attackers to achieve Remote Code Execution (RCE) via malicious OpenAPI specifications. The flaw resides in the Model Context Protocol (MCP) generator, where metadata is unsafely interpolated into generated code.
TL;DR
If you use orval to generate MCP servers, a malicious OpenAPI spec can execute arbitrary code on your machine or CI/CD pipeline. The generator fails to escape summary and operationName fields, allowing attackers to break out of string literals and inject JavaScript logic into the resulting source file. Fixed in version 7.18.0.
⚠️ Exploit Status: POC
Technical Details
- CWE ID: CWE-77
- Attack Vector: Network (via malicious Spec)
- CVSS: 9.3 (Critical)
- EPSS Score: 0.00047 (Low)
- Impact: Remote Code Execution (RCE)
- Exploit Status: PoC Available
Affected Systems
- orval
- @orval/mcp
- Node.js environments running generated MCP servers
-
orval: < 7.18.0 (Fixed in:
7.18.0) -
@orval/mcp: < 7.18.0 (Fixed in:
7.18.0)
Code Analysis
Commit: 80b5fe7
fix(mcp): sanitize content to prevent code injection
- '${verbOption.operationName}',
- '${verbOption.summary}',${imputSchemaImplementation ? `\n${imputSchemaImplementation}` : ''}
- ${verbOption.operationName}Handler
+ '${jsStringEscape(verbOption.operationName)}',
+ '${jsStringEscape(verbOption.summary)}',${inputSchemaImplementation ? `\n${inputSchemaImplementation}` : ''}
+ ${jsStringEscape(verbOption.operationName)}Handler
Exploit Details
- N/A: Vendor advisory describing the injection vector in MCP generation.
Mitigation Strategies
- Input Sanitization: Escape all user-supplied strings before interpolating into code templates.
- AST Generation: Use AST builders instead of string templates for code generation to ensure syntax validity and safety.
- Source Audit: Manually review generated files for suspicious code patterns before committing.
Remediation Steps:
- Check current version:
npm list orval - Update package:
npm install orval@latestor specificallynpm install orval@^7.18.0 - Regenerate client: Run the generation script to replace potentially malicious artifacts.
- Audit: Check
package-lock.jsonto ensure@orval/mcpis also updated.
References
Read the full report for CVE-2026-22785 on our website for more details including interactive diagrams and full exploit analysis.
Top comments (0)