GitHub Advisoryadvisory · NuGet

GHSA-3hrf-2gc2-mx32 Microsoft Kiota: XML Doc-Comment Newline Breakout Code Injection

HIGH Published 2026-07-24 Modified 2026-08-17 Official page ↗
Aliases
CVE-2026-59860
Ecosystem
NuGet
Packages
Microsoft.OpenApi.Kiota, Microsoft.OpenApi.Kiota.Builder
Severity
High
CVSS vector
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
Weaknesses
CWE-94
Reviewed
2026-07-24

Affected packages

• NuGet Microsoft.OpenApi.Kiota: >= 1.30.0, < 1.32.3 → fixed in 1.32.3 • NuGet Microsoft.OpenApi.Kiota.Builder: >= 1.30.0, < 1.32.3 → fixed in 1.32.3 • NuGet Microsoft.OpenApi.Kiota: < 1.29.1 → fixed in 1.29.1 • NuGet Microsoft.OpenApi.Kiota.Builder: < 1.29.1 → fixed in 1.29.1

Description

Summary Kiota versions prior to 1.32.3 and 1.29.1 are affected by a code-generation injection vulnerability in the C# XML documentation-comment sink (the `description`, `externalDocs` label, and `externalDocs` link fields emitted as `/// …` comments). When text from an OpenAPI description is written into single-line XML doc comments without stripping newline and Unicode line-terminator characters, an attacker can break out of the `///` comment line and inject additional code into generated C# clients. Impact and Preconditions This issue is only practically exploitable when: 1. the OpenAPI description used for generation is from an untrusted source, or 2. a normally trusted OpenAPI description has been compromised/tampered with. The injected code is compiled (and may execute) when the developer or CI builds the generated client. If you only generate from trusted, integrity-protected API descriptions, risk is significantly reduced. Affected Versions • Affected: all versions = 1.30.0, Note: this exploit is not limited to the `description` field, but may also impact the `externalDocs` label and link text and other doc-comment-derived locations. Remediation 1. Upgrade Kiota to 1.32.3 or later**. 2. Regenerate/refresh existing generated clients as a precaution: Refreshing generated clients ensures previously generated vulnerable code is replaced with hardened output. The fix (PR microsoft/kiota#7831) strips `\r`, `\n`, `\u0085`, `\u2028`, `\u2029` (and normalizes tabs) from description, label, and link text before emitting doc comments.

Related

Alias · CVE (1)

  • CVE-2026-59860 Kiota is an OpenAPI based HTTP Client code generator. vulnerability

Weakness · CWE (1)

  • CWE-94 Improper Control of Generation of Code weakness

References