CVE-2026-59862 Kiota: Code Generation Literal Injection in the Python Generator

High 7.5 Published Updated

Attacker-controlled enum descriptions in OpenAPI specs can inject Python code into generated modules, leading to execution upon import.

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-59862?

CVE-2026-59862 is a high-severity 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.0, Kiota's Python generator let attacker-controlled enum value descriptions from x-ms-enum.values[].description flow through KiotaBuilder.SetEnumOptions into Documentation.DescriptionTemplate and PythonConventionService.RemoveInvalidDescriptionCharacters without newline sanitization, allowing generated inline comments to split and execute attacker-controlled Python code at module scope when generated modules were imported. This issue is fixed in version 1.29.1 and 1.32.0.

Weakness: CWE-94

Which versions are affected by CVE-2026-59862?

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

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

How do I fix CVE-2026-59862?

Upgrade Microsoft.OpenAPI.Kiota to 1.32.0 or later.

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

Is CVE-2026-59862 being exploited?

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

Sources

Also known as GHSA-7f3j-j7jj-r3vr.

Is CVE-2026-59862 in your software?

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

Check your SBOMs for free