🛡️ CVE-2026-59866 — microsoft.openapi.kiota
Description
Microsoft Kiota: Arbitrary file write + code-injection via x-ms-kiota-info clientClassName and clientNamespaceName
Summary
Microsoft Kiota emitted the x-ms-kiota-info extension's clientClassName or clientNamespaceName value
raw, with no identifier or path sanitization, as both the generated client's class/namespace name
and part of the generated output path. When kiota generate is run without -c/--class-name — the
zero-config workflow that x-ms-kiota-info is explicitly designed for (the API provider supplies the names in
the description so consumers don't have to) — an attacker who controls or tampers with the OpenAPI description
could therefore:
- (CWE-22) write the generated source file to a path outside the
-ooutput directory — e.g.
clientClassName: "/var/www/html/shell"; and
- (CWE-94) inject arbitrary text into the generated class/namespace declaration, corrupting the generated
client.
Confirmed on Kiota 1.32.4 (the self-contained linux-x64 release binary), i.e. after the earlier
writer-sink hardening — that fix escaped property/enum/default/serialization sinks but never sanitized the
provider-supplied clientClassName / clientNamespaceName.
Details
clientClassName reached two unsanitized sinks (observed in the generated C#; the same raw emission occurred
for Java, Go, TypeScript, Python, and PHP):
```
# output FILENAME (CWE-22): clientClassName flows into the file path
clientClassName: "/abs/path/PWNED" -> /abs/path/PWNED.cs (written outside -o)
# class declaration (CWE-94): clientClassName flows verbatim into the type declaration
clientClassName: 'Pwn { } public class INJECTED { } public partial class RealClient'
-> public partial class Pwn { } public class INJECTED { } public partial class RealClient : ... { }
```
clientNamespaceName reached the analogous namespace/path sinks.
Impact
A developer or CI host generating a client from an attacker-controlled or compromised OpenAPI description
(without -c) could create/overwrite a generated source file at an attacker-influenced path and emit
attacker-controlled text into the generated client.
This does not reach clean remote code execution: because clientClassName is reused verbatim at multiple
sites (the class name and the constructor name), injected code cannot be made to compile — it breaks the
build. So the code-injection vector is a generation/build-corruption (integrity/DoS), and the high-severity
primitive is the file write. CWE-22 / CWE-94.
Patches
Fixed in 1.32.5 (https://github.com/microsoft/kiota/pull/7884). clientClassName and
clientNamespaceName sourced from x-ms-kiota-info are now sanitized before use:
GenerationConfiguration.SanitizeClientClassName strips any character outside [A-Za-z0-9_] and any invalid
leading character (falling back to ApiClient), and SanitizeClientNamespaceName restricts to
[A-Za-z0-9._-], collapses consecutive dots, strips invalid leading characters (falling back to ApiSdk).
This removes path separators, drive/colon, .., quotes, and braces, so the values can no longer influence
the output path or inject into the declaration.
Remediation
Upgrade to Kiota 1.32.5 or later and regenerate affected clients.
How this vulnerability can be exploited
This issue can be reached over the network, attack complexity is low, an attacker needs no privileges on the target. A user must actively cooperate. Rated impact: confidentiality none, integrity high, availability low.
Weakness class
CVE-2026-59866 is classified as CWE-22: Path Traversal. A file path built from user input is not confined to the intended directory, letting an attacker reach files elsewhere on the filesystem.
Affected software
CVE-2026-59866 is recorded against 3 packages.
- microsoft.openapi.kiota (fixed in 1.32.5)
- microsoft.openapi.kiota.builder (fixed in 1.32.5)
- unknown
Timeline and source
Published on 24 July 2026. No public exploit is currently recorded for this entry. Record sourced from NVD.
References
github.com (Web)
nvd.nist.gov (Advisory)
github.com (Web)
github.com (Web)
github.com (Package)
github.com (Web)
Details
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:N/VI:H/VA:L/SC:N/SI:N/SA:N
Affected Packages
| Software | From version | Fixed in |
|---|---|---|
| microsoft.openapi.kiota | — | 1.32.5 |
| microsoft.openapi.kiota.builder | — | 1.32.5 |
| unknown | — | — |
References
Similar Threats
- Unknown GHSA-p5rm-jg5c-8c77
- High CVE-2026-59859
- High CVE-2026-59860
- High CVE-2026-59861
- High CVE-2026-59862
More CVE 2026 advisories
Browse all of CVE 2026 in the advisory index.
Site Security Check
Is microsoft.openapi.kiota part of your stack?
CVE-2026-59866 is rated CVSS 8.0 High. BotEraser scans your installation against known CVE records and tells you whether this vulnerability applies to the versions you actually run.
Scan My Site Free →No credit card required · Results in minutes
ⓘ Data Notice: The information presented above has been compiled from publicly available internet sources. Boteraser aggregates this data solely for informational purposes and does not independently classify, evaluate, or endorse any findings about the vulnerabilities listed. The accuracy and completeness of this information is the sole responsibility of the original publishers. Boteraser and its operators accept no liability for any decisions made based on this data.