GHSA-3hrf-2gc2-mx32

Suggest an improvement
Source
https://github.com/advisories/GHSA-3hrf-2gc2-mx32
Import Source
https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/07/GHSA-3hrf-2gc2-mx32/GHSA-3hrf-2gc2-mx32.json
JSON Data
https://api.osv.dev/v1/vulns/GHSA-3hrf-2gc2-mx32
Aliases
Published
2026-07-24T15:30:47Z
Modified
2026-07-24T15:49:06.884069772Z
Severity
  • 8.7 (High) CVSS_V4 - 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/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X CVSS Calculator
Summary
Microsoft Kiota: XML Doc-Comment Newline Breakout Code Injection
Details

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)

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

Database specific
{
    "severity": "HIGH",
    "github_reviewed": true,
    "nvd_published_at": "2026-07-16T15:16:35Z",
    "github_reviewed_at": "2026-07-24T15:30:47Z",
    "cwe_ids": [
        "CWE-94"
    ]
}
References

Affected packages

NuGet / Microsoft.OpenApi.Kiota

Package

Name
Microsoft.OpenApi.Kiota
View open source insights on deps.dev
Purl
pkg:nuget/Microsoft.OpenApi.Kiota

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
1.32.3

Affected versions

0.*
0.1.0-preview
0.1.1-preview
0.1.2-preview
0.1.3-preview
0.2.0-preview
0.2.1-preview
0.3.0-preview
0.4.0-preview
0.5.0-preview
0.5.1-preview
0.6.0-preview
0.7.1-preview
0.8.3-preview
0.9.0-preview
0.10.0-preview
0.11.0-preview
0.11.1-preview
1.*
1.0.0
1.0.1
1.1.0
1.1.1
1.1.2
1.1.3
1.2.0
1.2.1
1.3.0
1.4.0
1.5.0
1.5.1
1.6.1
1.7.0
1.8.0
1.8.1
1.8.2
1.9.0
1.9.1
1.10.0
1.10.1
1.11.0
1.11.1
1.12.0
1.13.0
1.14.0
1.15.0
1.16.0
1.17.0
1.18.0
1.19.0
1.19.1
1.20.0
1.21.0
1.22.0
1.22.1
1.22.2
1.22.3
1.23.0
1.24.0
1.24.1
1.24.2
1.24.3
1.25.1
1.26.0
1.26.1
1.27.0
1.28.0
1.29.0
1.30.0
1.31.0
1.31.1
1.32.0
1.32.1
1.32.2

Database specific

source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/07/GHSA-3hrf-2gc2-mx32/GHSA-3hrf-2gc2-mx32.json"

NuGet / Microsoft.OpenApi.Kiota.Builder

Package

Name
Microsoft.OpenApi.Kiota.Builder
View open source insights on deps.dev
Purl
pkg:nuget/Microsoft.OpenApi.Kiota.Builder

Affected ranges

Type
ECOSYSTEM
Events
Introduced
0Unknown introduced version / All previous versions are affected
Fixed
1.32.3

Affected versions

0.*
0.2.0-preview
0.3.0-preview
0.4.0-preview
0.5.0-preview
0.5.1-preview
0.6.0-preview
0.7.1-preview
1.*
1.0.0
1.0.1
1.1.0
1.1.1
1.1.2
1.1.3
1.2.0
1.2.1
1.3.0
1.4.0
1.5.0
1.5.1
1.6.1
1.7.0
1.8.0
1.8.1
1.8.2
1.9.0
1.9.1
1.10.0
1.10.1
1.11.0
1.11.1
1.12.0
1.13.0
1.14.0
1.15.0
1.16.0
1.17.0
1.18.0
1.19.0
1.19.1
1.20.0
1.21.0
1.22.0
1.22.1
1.22.2
1.22.3
1.23.0

Database specific

source
"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/07/GHSA-3hrf-2gc2-mx32/GHSA-3hrf-2gc2-mx32.json"