CVE-2026-59860 — Vulnerability in Microsoft.OpenApi.Kiota
Microsoft Kiota: XML Doc-Comment Newline Breakout Code Injection
What Should I Do?
Address in Next Maintenance Window
Low exploitation probability (1.38%). Schedule for your next planned update.
Does your project use an affected Microsoft.OpenApi.Kiota version?
Paste your packages.lock.json to check it for CVE-2026-59860 and every other known vulnerability, with CISA KEV and EPSS on each finding. Free with no signup for up to 10 packages, or up to 500 per scan with a free account, which also keeps up to 200 packages in saved projects.
Summary
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:
- the OpenAPI description used for generation is from an untrusted source, or
- 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.29.1, >= 1.30.0, < 1.32.3
- Fixed: 1.29.1, 1.32.3, and later
Illustrative Exploit Example
Example OpenAPI fragment (malicious description)
openapi: 3.0.1
info:
title: Exploit Demo
version: 1.0.0
description: |-
Legitimate summary text
public static class Pwned { static Pwned() { System.Diagnostics.Process.Start("calc.exe"); } }
The newline inside description (also exploitable via \r, U+0085, U+2028, U+2029) terminates the doc-comment line.
Example generated C# snippet before fix (illustrative)
/// Legitimate summary text
public static class Pwned { static Pwned() { System.Diagnostics.Process.Start("calc.exe"); } }
The injected payload escapes the intended /// comment context and introduces attacker-controlled statements in generated code.
Note: this exploit is not limited to the
descriptionfield, but may also impact theexternalDocslabel and link text and other doc-comment-derived locations.
Remediation
- Upgrade Kiota to 1.32.3 or later.
- 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.
Advisory Timeline
- First published July 24, 2026 (125 days ago).
- Last revised August 17, 2026 — 24 days after initial publication.
Remediation
Upgrade to the fixed version using your package manager.
dotnet add package Microsoft.OpenApi.Kiota --version 1.32.3
dotnet add package Microsoft.OpenApi.Kiota.Builder --version 1.32.3
dotnet add package Microsoft.OpenApi.Kiota --version 1.29.1
dotnet add package Microsoft.OpenApi.Kiota.Builder --version 1.29.1
After upgrading, scan your dependencies again to confirm the vulnerability is resolved.
Affected Packages (4)
Affects 1 ecosystem: NuGet (2).
| Package | Fixed In |
|---|---|
| Microsoft.OpenApi.Kiota NuGet · Affected: 1.30.0, 1.31.0, 1.31.1, 1.32.0 (+2 more) | 1.32.3 |
| Microsoft.OpenApi.Kiota.Builder NuGet · Affected: All versions | 1.32.3 |
| Microsoft.OpenApi.Kiota NuGet · Affected: 0.1.0-preview, 0.1.1-preview, 0.1.2-preview, 0.1.3-preview (+62 more) | 1.29.1 |
| Microsoft.OpenApi.Kiota.Builder NuGet · Affected: 0.2.0-preview, 0.3.0-preview, 0.4.0-preview, 0.5.0-preview (+42 more) | 1.29.1 |
Vulnerability Classification
Common Weakness Enumeration (CWE) identifiers for this vulnerability type.
- CWE-94Code InjectionMITRE
CVSS Score Breakdown
What the CVSS (Common Vulnerability Scoring System) 8.8 score means for each attack dimension.
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
References
- https://github.com/microsoft/kiota/security/advisories/GHSA-3hrf-2gc2-mx32WEB
- https://nvd.nist.gov/vuln/detail/CVE-2026-59860ADVISORY
- https://github.com/microsoft/kiota/pull/7831WEB
- https://github.com/microsoft/kiota/commit/ebb632db90aa8e3c20949337d9faa2720d64ca44WEB
- https://github.com/microsoft/kiotaPACKAGE
- https://github.com/microsoft/kiota/releases/tag/v1.32.3WEB
Frequently Asked Questions
- What is CVE-2026-59860?
- Microsoft Kiota: XML Doc-Comment Newline Breakout Code Injection. This vulnerability has been assigned a severity rating of HIGH (CVSS score: 8.8/10).
- How do I check if my project is affected by CVE-2026-59860?
- CVE-2026-59860 affects Microsoft.OpenApi.Kiota and Microsoft.OpenApi.Kiota.Builder. It has a 1.4% probability of exploitation within 30 days (EPSS score). Use GeekWala's free vulnerability scanner to check your dependencies against CVE-2026-59860 and 200,000+ other known vulnerabilities.
Severity & Exploitability
Significant impact if exploited, or exploitable with modest effort.
This is an above-median EPSS score — 72.3% of tracked vulnerabilities score at or below it, putting its exploitation likelihood in the upper half of the tracked corpus.
Also Known As
Related CVEs
- CVE-2026-59864CRITICAL
Microsoft Kiota: Path/URL injection into generated Copilot plugin manifest via x-ai-* extensions
- CVE-2026-59865CRITICAL
Microsoft Kiota: Command injection via x-ms-kiota-info dependencyInstallCommand surfaced by `kiota info`
- CVE-2026-59863HIGH
Microsoft Kiota Workspace-config poisoning: out-of-repo file write + generation-time SSRF
- CVE-2026-59866HIGH
Microsoft Kiota: Arbitrary file write + code-injection via x-ms-kiota-info clientClassName and clientNamespaceName
- CVE-2026-59862HIGH
Microsoft Kiota: Code Generation Literal Injection in Kiota Python Generator
- CVE-2026-59859HIGH
Microsoft Kiota: Code Generation Literal Injection in Kiota PHP Generator
- CVE-2026-59867HIGH
Microsoft Kiota: Generation-time SSRF + remote/local file inclusion via unrestricted $ref
- CVE-2026-105796HIGH
Kiota: Code injection through doc-comment delimiter reformation in Kiota Java and PHP generators