CVE-2026-59861 Kiota: Code Generation Literal Injection in Kiota Ruby Generator
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.
| Package | Affected | Fixed in |
|---|---|---|
Microsoft.OpenAPI.Kiota NuGet | From 1.30.0 | 1.32.0 |
Microsoft.OpenAPI.Kiota NuGet | From 1.30.0 | 1.32.0 |
Microsoft.OpenAPI.Kiota.Builder NuGet | From 1.30.0 | 1.32.0 |
Microsoft.OpenAPI.Kiota.Builder NuGet | From 1.30.0 | 1.32.0 |
Microsoft.OpenApi.Kiota NuGet | All versions | 1.29.1 |
Microsoft.OpenApi.Kiota NuGet | All versions | 1.29.1 |
2 more packages
Microsoft.OpenApi.Kiota.Builder NuGet | All versions | 1.29.1 |
Microsoft.OpenApi.Kiota.Builder NuGet | All versions | 1.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.