CVE-2026-59860: Kiota: XML Doc-Comment Newline Breakout Code Injection

Published Jul 16, 2026
·
Updated

Summary

Kiota versions prior to 1.32.3 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.32.3 - Fixed: 1.32.3 and later

Illustrative Exploit Example

Example OpenAPI fragment (malicious description)

yaml 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)

csharp /// 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 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.

Other sources

Kiota is an OpenAPI based HTTP Client code generator. Prior to 1.29.1 and 1.32.3, Kiota is 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. This issue is fixed in version 1.29.1 and 1.32.3.

MITRE

Kiota is an OpenAPI based HTTP Client code generator. Prior to 1.32.3, Kiota is 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. This issue is fixed in version 1.32.3.

NVD

Affected Software

3 affected componentsFixes available
Kiota Kiota<1.32.3
nuget/Microsoft.OpenApi.Kiota.Builder<1.32.3
1.32.3
nuget/Microsoft.OpenApi.Kiota<1.32.3
1.32.3

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade nuget/Microsoft.OpenApi.Kiota.Builder to a version that resolves this vulnerability.

    Fixed in 1.32.3
  2. Upgrade

    Upgrade nuget/Microsoft.OpenApi.Kiota to a version that resolves this vulnerability.

    Fixed in 1.32.3
  3. Upgrade

    Upgrade Kiota to a version that resolves this vulnerability.

    Fixed in 1.32.3Patch microsoft/kiota#7831
  4. Operational

    Regenerate/refresh existing generated C# clients after upgrading Kiota to ensure previously generated vulnerable code is replaced with the hardened output (PR microsoft/kiota#7831 strips newline/line-terminator characters from OpenAPI description/externalDocs label/link text before emitting /// doc comments).

Event History

Jul 16, 2026
CVE Published
via MITRE·02:34 PM
Data Sourced
via MITRE·02:34 PM
DescriptionWeakness
Data Sourced
via NVD·03:16 PM
DescriptionSeverityWeakness
Jul 24, 2026
Advisory Published
via GitHub·03:30 PM
Data Sourced
via GitHub·03:30 PM
DescriptionWeaknessAffected Software
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2026-59860?

The severity of CVE-2026-59860 is high with a score of 8.7.

2

What type of vulnerability is associated with CVE-2026-59860?

CVE-2026-59860 is a code injection vulnerability that affects the Kiota HTTP Client code generator.

3

How do I fix CVE-2026-59860?

To mitigate CVE-2026-59860, upgrade Kiota to version 1.32.3 or later.

4

What is the impact of CVE-2026-59860?

CVE-2026-59860 allows code-generation injection through the C# XML documentation-comment sink.

5

When was CVE-2026-59860 published?

CVE-2026-59860 was published on July 16, 2026.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203