CVE-2026-59859 Kiota: Code Generation Literal Injection in the PHP Generator
Attackers can inject arbitrary PHP code into generated client classes via malicious OpenAPI schemas, requiring developers to upgrade Kiota.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Over the internet
- Victim action needed
- A user has to click or open something
- Fix
- Available
What is CVE-2026-59859?
CVE-2026-59859 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, and only if a user opens a file or follows a link.
Official description
Kiota is an OpenAPI based HTTP Client code generator. Prior to 1.29.1 and 1.32.4, Kiota's PHP generator embedded OpenAPI description, default fields, property names, and other schema-derived strings into PHP double-quoted literals through SanitizeDoubleQuote() in Writers/StringExtensions.cs without escaping $, allowing attacker-controlled ${...}, $var, or {$obj->prop} interpolation constructs to inject arbitrary PHP code into generated model and request-builder classes. This issue is fixed in version 1.29.1 and 1.32.4.
Weakness: CWE-94
Which versions are affected by CVE-2026-59859?
8 open source packages ship an affected version, including Microsoft.OpenApi.Kiota and Microsoft.OpenApi.Kiota.Builder.
| Package | Affected | Fixed in |
|---|---|---|
Microsoft.OpenApi.Kiota NuGet | All versions | 1.29.1 |
Microsoft.OpenApi.Kiota NuGet | All versions | 1.29.1 |
Microsoft.OpenApi.Kiota NuGet | From 1.30.0 | 1.32.4 |
Microsoft.OpenApi.Kiota NuGet | From 1.30.0 | 1.32.4 |
Microsoft.OpenApi.Kiota.Builder NuGet | All versions | 1.29.1 |
Microsoft.OpenApi.Kiota.Builder NuGet | All versions | 1.29.1 |
2 more packages
Microsoft.OpenApi.Kiota.Builder NuGet | From 1.30.0 | 1.32.4 |
Microsoft.OpenApi.Kiota.Builder NuGet | From 1.30.0 | 1.32.4 |
How do I fix CVE-2026-59859?
Upgrade Microsoft.OpenApi.Kiota to a fixed version for your release line: 1.29.1 or 1.32.4.
Upgrade, and never evaluate templates, expressions or code built from user input. More about Code injection.
Is CVE-2026-59859 being exploited?
There is no known exploitation of CVE-2026-59859 in the wild and no public exploit code.
Sources
Also known as GHSA-jqwh-526h-c92j.