CVE-2026-59861 Kiota: Code Generation Literal Injection in Kiota Ruby Generator

High 7.5 Published Updated

Attackers can inject arbitrary Ruby code into generated model classes via unescaped interpolation markers in OpenAPI schemas, affecting Kiota users.

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

CVE-2026-59861 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 Ruby generator embedded OpenAPI default fields, property names, and other schema-derived strings through CodeMethodWriter.cs and SanitizeForQuotedLiteral() in Writers/StringExtensions.cs into Ruby double-quoted literals without escaping #, allowing attacker-controlled #{expr}, #$var, or #@var interpolation markers to inject arbitrary Ruby code into generated model classes. This issue is fixed in version 1.29.1 and 1.32.0.

Weakness: CWE-94

Which versions are affected by CVE-2026-59861?

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

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-59861 being exploited?

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

Sources

Also known as GHSA-xg2h-5xr2-29jw.

Is CVE-2026-59861 in your software?

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

Check your SBOMs for free