Arbitrary Code Injection Affecting microsoft.openapi.kiota package, versions [,1.32.3)


Severity

Recommended
0.0
high
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

EPSS
1.02% (60th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk IDSNYK-DOTNET-MICROSOFTOPENAPIKIOTA-18021356
  • published20 Jul 2026
  • disclosed16 Jul 2026
  • creditthegr1ffyn

Introduced: 16 Jul 2026

NewCVE-2026-59860  (opens in a new tab)
CWE-94  (opens in a new tab)

How to fix?

Upgrade Microsoft.OpenApi.Kiota to version 1.32.3 or higher.

Overview

Affected versions of this package are vulnerable to Arbitrary Code Injection through the C# doc-comment generation in CSharpConventionService and OpenApiUrlTreeNodeExtensions. An attacker can inject executable C# into generated clients by supplying description, externalDocs label, or link text containing newline or Unicode line-terminator characters that break out of the /// comment context. When a developer or CI builds the generated client, the injected text is compiled as source code, which can lead to arbitrary code execution in the resulting application. The issue affects generated C# documentation comments emitted from untrusted or tampered OpenAPI descriptions.

Notes

  • The vulnerable doc-comment sinks are in the C# generator path, so the issue is in generated clients rather than the runtime parser or OpenAPI ingestion itself.
  • The injected payload is only compiled when the generated client source is built, so exploitation depends on a build step consuming the generated code from an untrusted or tampered OpenAPI description.

Workarounds

  • Only generate clients from trusted, integrity-protected OpenAPI descriptions; avoid using untrusted or tampered API descriptions as input to generation.

CVSS Base Scores

version 4.0
version 3.1