CVE-2026-59859: CWE-94: Improper Control of Generation of Code ('Code Injection') in microsoft kiota
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.
AI Analysis
Technical Summary
The Kiota PHP code generator improperly handles string interpolation in PHP double-quoted literals by failing to escape the '$' character in OpenAPI schema-derived strings such as descriptions, default values, and property names. This allows an attacker controlling an OpenAPI specification to inject arbitrary PHP code into generated model and request-builder classes. The root cause is the SanitizeDoubleQuote() function in Writers/StringExtensions.cs, which does not escape '$', enabling runtime evaluation of interpolation expressions. The vulnerability affects Kiota versions prior to 1.32.4 and was addressed in pull request #7863.
Potential Impact
If exploited, this vulnerability can lead to arbitrary PHP code execution in applications using generated clients from untrusted OpenAPI specifications. This is critical when vulnerable generated code is deployed to production environments, potentially compromising application integrity and confidentiality. It is also high risk in CI/CD pipelines that automatically regenerate code from remote specs with access to production secrets. The severity is medium for public third-party specs and low for developer-controlled specs.
Mitigation Recommendations
Upgrade Microsoft Kiota to version 1.29.1, 1.32.4, or later to obtain the official fix. Regenerate all existing PHP clients to replace vulnerable generated code with patched output. If immediate upgrade is not possible, audit and sanitize OpenAPI specifications to remove or replace '$' characters in strings, conduct mandatory code reviews of generated PHP files to detect interpolation patterns, restrict OpenAPI specs to trusted sources, avoid deploying generated code to production without verification, and manually escape '$' characters in generated files as a temporary measure.
CVE-2026-59859: CWE-94: Improper Control of Generation of Code ('Code Injection') in microsoft kiota
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.
CVSS v4.0
Score 8.7high
Affected software
Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
Weaknesses
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
The Kiota PHP code generator improperly handles string interpolation in PHP double-quoted literals by failing to escape the '$' character in OpenAPI schema-derived strings such as descriptions, default values, and property names. This allows an attacker controlling an OpenAPI specification to inject arbitrary PHP code into generated model and request-builder classes. The root cause is the SanitizeDoubleQuote() function in Writers/StringExtensions.cs, which does not escape '$', enabling runtime evaluation of interpolation expressions. The vulnerability affects Kiota versions prior to 1.32.4 and was addressed in pull request #7863.
Potential Impact
If exploited, this vulnerability can lead to arbitrary PHP code execution in applications using generated clients from untrusted OpenAPI specifications. This is critical when vulnerable generated code is deployed to production environments, potentially compromising application integrity and confidentiality. It is also high risk in CI/CD pipelines that automatically regenerate code from remote specs with access to production secrets. The severity is medium for public third-party specs and low for developer-controlled specs.
Mitigation Recommendations
Upgrade Microsoft Kiota to version 1.29.1, 1.32.4, or later to obtain the official fix. Regenerate all existing PHP clients to replace vulnerable generated code with patched output. If immediate upgrade is not possible, audit and sanitize OpenAPI specifications to remove or replace '$' characters in strings, conduct mandatory code reviews of generated PHP files to detect interpolation patterns, restrict OpenAPI specs to trusted sources, avoid deploying generated code to production without verification, and manually escape '$' characters in generated files as a temporary measure.
Technical Details
- Data Version
- 5.2
- Assigner Short Name
- GitHub_M
- Date Reserved
- 2026-07-07T15:41:53.606Z
- Cvss Version
- 4.0
- State
- PUBLISHED
- Remediation Level
- null
Threat ID: 6a58ef3568715ace43306131
Added to database: 07/16/2026, 14:48:21 UTC
Last enriched: 08/17/2026, 16:24:58 UTC
Last updated: 08/30/2026, 10:52:10 UTC
Views: 98
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.