CVE-2026-59860: Microsoft Kiota XML Doc-Comment Newline Breakout Code Vulnerability
HIGHCVE-2026-59860 is a HIGH xml doc-comment newline breakout code vulnerability (CWE-94: Improper Control of Generation of Code ('Code Injection')) affecting Microsoft Kiota libraries in the NuGet ecosystem. The issue involves xml doc-comment newline breakout code injection. Remediation is available by upgrading affected packages to version 1.32.3, 1.29.1.
CVE-2026-59860 at a Glance
How to Fix CVE-2026-59860
To remediate this vulnerability, upgrade all affected Microsoft Kiota dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.
Upgrade Microsoft.OpenApi.Kiota to 1.32.3
Upgrade Microsoft.OpenApi.Kiota.Builder to 1.32.3
Upgrade Microsoft.OpenApi.Kiota to 1.29.1
Upgrade Microsoft.OpenApi.Kiota.Builder to 1.29.1
Run the following command in your project directory to verify that all resolved dependencies use the patched release:
inspect dependencies for Microsoft.OpenApi.Kiota
How to Check if You Are Affected
To determine whether your application is affected by CVE-2026-59860, inspect your project dependencies for Microsoft Kiota:
inspect dependencies for Microsoft.OpenApi.Kiota
Analyze the terminal output to locate any version of Microsoft Kiota in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.32.3), your application is affected.
Note: Verify declared build manifests and deployed runtime container environments.
Technical Details
Vulnerability Mechanism & Technical Analysis
This vulnerability is classified under CWE-94: Improper Control of Generation of Code ('Code Injection'), where the product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. In Microsoft Kiota, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.
Source Advisory Statement
CVE-2026-59860 Affected Microsoft Kiota Versions
4 component(s)| Product / Package | Ecosystem | Affected Versions | Fixed Version |
|---|---|---|---|
|
Microsoft.OpenApi.Kiota
|
NuGet |
≥ 1.30.0
< 1.32.3
|
1.32.3
|
|
Microsoft.OpenApi.Kiota.Builder
|
NuGet |
≥ 1.30.0
< 1.32.3
|
1.32.3
|
|
Microsoft.OpenApi.Kiota
|
NuGet |
< 1.29.1
|
1.29.1
|
|
Microsoft.OpenApi.Kiota.Builder
|
NuGet |
< 1.29.1
|
1.29.1
|
References
Frequently Asked Questions
What is CVE-2026-59860?
Which Microsoft Kiota versions are affected?
What version fixes CVE-2026-59860?
Is Microsoft.OpenApi.Kiota affected?
Is Microsoft.OpenApi.Kiota.Builder affected?
What CWE is associated with CVE-2026-59860?
How can I check NuGet dependencies for CVE-2026-59860?
Machine-readable OSV JSON
OSV v1.5 Schema
{
"schema_version" : "1.4.0",
"id" : "GHSA-3hrf-2gc2-mx32",
"modified" : "2026-08-17T14:52:01Z",
"published" : "2026-07-24T15:30:47Z",
"aliases" : [ "CVE-2026-59860" ],
"summary" : "Microsoft Kiota: XML Doc-Comment Newline Breakout Code Injection",
"details" : "### Summary\n\nKiota 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).\n\nWhen 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.\n\n## Impact and Preconditions\n\nThis issue is only practically exploitable when:\n\n1. the OpenAPI description used for generation is from an **untrusted source**, or\n2. a normally trusted OpenAPI description has been **compromised/tampered with**.\n\nThe 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.\n\n## Affected Versions\n\n- **Affected:** all versions **< 1.29.1**, **>= 1.30.0, < 1.32.3**\n- **Fixed: 1.29.1, 1.32.3,** and later\n\n## Illustrative Exploit Example\n\n### Example OpenAPI fragment (malicious description)\n\n```yaml\nopenapi: 3.0.1\ninfo:\n title: Exploit Demo\n version: 1.0.0\n description: |-\n Legitimate summary text\n public static class Pwned { static Pwned() { System.Diagnostics.Process.Start(\"calc.exe\"); } }\n```\n\nThe newline inside `description` (also exploitable via `\\r`, U+0085, U+2028, U+2029) terminates the doc-comment line.\n\n### Example generated C# snippet before fix (illustrative)\n\n```csharp\n/// Legitimate summary text\npublic static class Pwned { static Pwned() { System.Diagnostics.Process.Start(\"calc.exe\"); } }\n```\n\nThe injected payload escapes the intended `///` comment context and introduces attacker-controlled statements in generated code.\n\n> 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.\n\n## Remediation\n\n1. Upgrade Kiota to **1.32.3 or later**.\n2. Regenerate/refresh existing generated clients as a precaution:\n\nRefreshing 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.",
"severity" : [ {
"type" : "CVSS_V4",
"score" : "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"
} ],
"affected" : [ {
"package" : {
"ecosystem" : "NuGet",
"name" : "Microsoft.OpenApi.Kiota"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "1.30.0"
}, {
"fixed" : "1.32.3"
} ]
} ]
}, {
"package" : {
"ecosystem" : "NuGet",
"name" : "Microsoft.OpenApi.Kiota.Builder"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "1.30.0"
}, {
"fixed" : "1.32.3"
} ]
} ]
}, {
"package" : {
"ecosystem" : "NuGet",
"name" : "Microsoft.OpenApi.Kiota"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "1.29.1"
} ]
} ]
}, {
"package" : {
"ecosystem" : "NuGet",
"name" : "Microsoft.OpenApi.Kiota.Builder"
},
"ranges" : [ {
"type" : "ECOSYSTEM",
"events" : [ {
"introduced" : "0"
}, {
"fixed" : "1.29.1"
} ]
} ]
} ],
"references" : [ {
"type" : "WEB",
"url" : "https://github.com/microsoft/kiota/security/advisories/GHSA-3hrf-2gc2-mx32"
}, {
"type" : "ADVISORY",
"url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-59860"
}, {
"type" : "WEB",
"url" : "https://github.com/microsoft/kiota/pull/7831"
}, {
"type" : "WEB",
"url" : "https://github.com/microsoft/kiota/commit/ebb632db90aa8e3c20949337d9faa2720d64ca44"
}, {
"type" : "PACKAGE",
"url" : "https://github.com/microsoft/kiota"
}, {
"type" : "WEB",
"url" : "https://github.com/microsoft/kiota/releases/tag/v1.32.3"
} ],
"database_specific" : {
"cwe_ids" : [ "CWE-94" ],
"severity" : "HIGH",
"github_reviewed" : true,
"github_reviewed_at" : "2026-07-24T15:30:47Z",
"nvd_published_at" : "2026-07-16T15:16:35Z"
}
}