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

Critical 9.3 Published Updated

Attackers can inject arbitrary code and write files outside the output directory via malicious OpenAPI descriptions in Kiota code generation.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2026-59866?

CVE-2026-59866 is a critical code injection vulnerability in microsoft kiota, published on 16 Jul 2026. An attacker can exploit it over the internet without logging in, with no action from the victim.

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

Weakness: CWE-94, CWE-22

Which versions are affected by CVE-2026-59866?

8 open source packages ship an affected version, including Microsoft.OpenApi.Kiota and Microsoft.OpenApi.Kiota.Builder.

PackageAffectedFixed in
Microsoft.OpenApi.Kiota NuGetAll versions1.29.1
Microsoft.OpenApi.Kiota NuGetAll versions1.29.1
Microsoft.OpenApi.Kiota NuGetFrom 1.30.01.32.5
Microsoft.OpenApi.Kiota NuGetFrom 1.30.01.32.5
Microsoft.OpenApi.Kiota.Builder NuGetAll versions1.29.1
Microsoft.OpenApi.Kiota.Builder NuGetAll versions1.29.1
2 more packages
Microsoft.OpenApi.Kiota.Builder NuGetFrom 1.30.01.32.5
Microsoft.OpenApi.Kiota.Builder NuGetFrom 1.30.01.32.5

How do I fix CVE-2026-59866?

Upgrade Microsoft.OpenApi.Kiota to a fixed version for your release line: 1.29.1 or 1.32.5.

Upgrade, and never evaluate templates, expressions or code built from user input. More about Code injection.

Is CVE-2026-59866 being exploited?

There is no known exploitation of CVE-2026-59866 in the wild and no public exploit code.

Sources

Also known as GHSA-4vv7-jj25-4gh6.

Is CVE-2026-59866 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free