Junglewise Threat Intelligence

CVE-2026-22785: orval MCP code injection in OpenAPI summary field

CVE-2026-22785 · Severity: medium · CVSS 4 · Published 2026-01-13

Vendors: npm.

Executive brief

Orval is a code generation tool that creates API clients from OpenAPI specifications. The tool fails to properly validate the summary field in OpenAPI definitions, allowing attackers to inject and execute arbitrary code during the code generation process. An attacker could exploit this by hosting a malicious OpenAPI specification that executes arbitrary commands when a developer runs Orval to generate code.

Technical details

The vulnerability is a code injection flaw (CWE-77) in the MCP server generation logic. The root cause is unsanitized string manipulation: the summary field from an OpenAPI specification is incorporated directly into generated code without proper escaping or validation. An attacker can craft a malicious OpenAPI YAML/JSON file with a specially crafted summary field (e.g., containing string concatenation and require() calls) that breaks out of the string literal context and injects arbitrary JavaScript code. The attack requires the developer to run Orval CLI against the attacker-controlled OpenAPI specification; no authentication or network connectivity beyond retrieving the spec is needed. Successful exploitation allows arbitrary code execution in the context of the developer's machine. The vulnerability is fixed in version 7.18.0 and later.

Affected products

  • orval @orval/mcp before 7.18.0

Timeline

  • 2026-01-13: disclosed
  • 2026-01-13: patched: Fixed in version 7.18.0 or higher

References