CVE-2026-59859
Kiota: Code Generation Literal Injection in the PHP Generator
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.
Attack profile
How easy it is to exploit
- Attack vector
- Network
- Complexity
- Low
- Privileges needed
- None
- User interaction
- Passive
What an attacker can affect
- Confidentiality
- High
- Integrity
- High
- Availability
- High
Exploit likelihood
What each source reports
CVE List Score used
8.7
Kiota: Code Generation Literal Injection in the PHP Generator
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.
- Record
CVE-2026-59859- CVSS 4.0
- 8.7 High
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N - Weakness
- CWE-94
- Updated
- 2026-11-02
EUVDEUVD-2026-44928
8.7
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.
- Record
EUVD-2026-44928- CVSS 4.0
- 8.7 High
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N - Updated
- 2026-11-02
GitHub AdvisoriesGHSA-jqwh-526h-c92j
8.7
Microsoft Kiota: Code Generation Literal Injection in Kiota PHP Generator
Impact
The Kiota PHP code generator is vulnerable to a code generation literal injection attack. The generator embeds string values from OpenAPI fields (e.g. description, default values, and property names) directly into PHP double-quoted string literals without properly escaping the $ character. Since PHP evaluates string interpolation expressions like "${expr}", "$var", and "{$obj->prop}" within double-quoted strings at runtime, an attacker who controls an OpenAPI specification file can inject arbitrary PHP code into generated model and request-builder classes.
Who is impacted
Developers using Kiota to generate PHP API clients from external or untrusted OpenAPI specifications
Teams with CI/CD pipelines configured to automatically regenerate client code from remote specs
Applications that deploy generated PHP code to production servers
Vulnerability details
Affected component: StringExtensions.cs
Root cause: The shared SanitizeDoubleQuote() function in Writers/StringExtensions.cs does not escape the $ character. As a result, any schema-derived string emitted as a PHP double-quoted literal preserves $-prefixed interpolation constructs (${...}, $var, {$...}) verbatim, which PHP evaluates at runtime instead of treating as literal text. This is the same class of code-generation literal-injection flaw previously fixed for the Ruby generator (# interpolation), recurring here as a missed variant for PHP's $ interpolation in the sibling sanitizer helper.
Attack vectors
OpenAPI description and default fields in schema properties
Property wire-name keys embedded in deserializer/serializer methods
Any schema-derived string embedded in PHP double-quoted literals
Severity: Critical when generated code reaches production; High for CI/CD environments with access to production secrets; Medium for public third-party specs; Low for developer-controlled specs.
Patches
Workarounds
If you cannot upgrade immediately:
- Audit and sanitize OpenAPI specifications: Review all OpenAPI specification files for any descriptions, default values, or property names containing the
$character. Remove or replace any suspicious strings before code generation. - Code review of generated files: Implement mandatory code review of all generated PHP files before merging into any branch. Look for double-quoted strings containing
${,$var, or{$patterns. - Restrict specification sources: Only consume OpenAPI specifications from trusted internal sources. Avoid automatic code generation from external or third-party APIs until this patch is applied.
- Isolate generated code from production: Do not deploy generated PHP models to production environments unless the specification source has been verified and reviewed.
- Manual escaping (temporary): If regeneration is not possible, manually inspect and edit generated files to escape any
$characters in double-quoted string literals (replace$with\$).
Remediation
Upgrade Kiota to 1.29.1, 1.32.4, or later.
Regenerate/refresh existing generated clients as a precaution:
Refreshing generated clients ensures previously generated vulnerable code is replaced with hardened output.
- Record
GHSA-jqwh-526h-c92j- CVSS 4.0
- 8.7 High
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N - Weakness
- CWE-94
- Updated
- 2026-11-02
NVD
8.7
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.
- Record
CVE-2026-59859- CVSS 4.0
- 8.7 High
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X - Weakness
- CWE-94
- Updated
- 2026-11-02
OSV
8.7
Kiota: Code Generation Literal Injection in the PHP Generator
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.
- Record
CVE-2026-59859- CVSS 4.0
- 8.7 High
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N - Weakness
- CWE-94
- Updated
- 2026-11-07
OSVGHSA-jqwh-526h-c92j
8.7
Microsoft Kiota: Code Generation Literal Injection in Kiota PHP Generator
Impact
The Kiota PHP code generator is vulnerable to a code generation literal injection attack. The generator embeds string values from OpenAPI fields (e.g. description, default values, and property names) directly into PHP double-quoted string literals without properly escaping the $ character. Since PHP evaluates string interpolation expressions like "${expr}", "$var", and "{$obj->prop}" within double-quoted strings at runtime, an attacker who controls an OpenAPI specification file can inject arbitrary PHP code into generated model and request-builder classes.
Who is impacted
Developers using Kiota to generate PHP API clients from external or untrusted OpenAPI specifications
Teams with CI/CD pipelines configured to automatically regenerate client code from remote specs
Applications that deploy generated PHP code to production servers
Vulnerability details
Affected component: StringExtensions.cs
Root cause: The shared SanitizeDoubleQuote() function in Writers/StringExtensions.cs does not escape the $ character. As a result, any schema-derived string emitted as a PHP double-quoted literal preserves $-prefixed interpolation constructs (${...}, $var, {$...}) verbatim, which PHP evaluates at runtime instead of treating as literal text. This is the same class of code-generation literal-injection flaw previously fixed for the Ruby generator (# interpolation), recurring here as a missed variant for PHP's $ interpolation in the sibling sanitizer helper.
Attack vectors
OpenAPI description and default fields in schema properties
Property wire-name keys embedded in deserializer/serializer methods
Any schema-derived string embedded in PHP double-quoted literals
Severity: Critical when generated code reaches production; High for CI/CD environments with access to production secrets; Medium for public third-party specs; Low for developer-controlled specs.
Patches
Workarounds
If you cannot upgrade immediately:
- Audit and sanitize OpenAPI specifications: Review all OpenAPI specification files for any descriptions, default values, or property names containing the
$character. Remove or replace any suspicious strings before code generation. - Code review of generated files: Implement mandatory code review of all generated PHP files before merging into any branch. Look for double-quoted strings containing
${,$var, or{$patterns. - Restrict specification sources: Only consume OpenAPI specifications from trusted internal sources. Avoid automatic code generation from external or third-party APIs until this patch is applied.
- Isolate generated code from production: Do not deploy generated PHP models to production environments unless the specification source has been verified and reviewed.
- Manual escaping (temporary): If regeneration is not possible, manually inspect and edit generated files to escape any
$characters in double-quoted string literals (replace$with\$).
Remediation
Upgrade Kiota to 1.29.1, 1.32.4, or later.
Regenerate/refresh existing generated clients as a precaution:
Refreshing generated clients ensures previously generated vulnerable code is replaced with hardened output.
- Record
GHSA-jqwh-526h-c92j- CVSS 4.0
- 8.7 High
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N - Weakness
- CWE-94
- Updated
- 2026-11-02
Affected products
Affected packages
| Package | Affected | Fixed |
|---|---|---|
Microsoft.OpenApi.KiotaNuGet |
1.30.0 up to 1.32.4 | 1.32.4 |
Microsoft.OpenApi.Kiota.BuilderNuGet |
1.30.0 up to 1.32.4 | 1.32.4 |
Microsoft.OpenApi.KiotaNuGet |
before 1.29.1 | 1.29.1 |
Microsoft.OpenApi.Kiota.BuilderNuGet |
before 1.29.1 | 1.29.1 |
Microsoft.OpenApi.KiotaNuGet |
1.30.0 up to 1.32.4, plus listed versions 1.31.01.31.11.32.01.32.11.32.21.32.3 |
1.32.4 |
Microsoft.OpenApi.KiotaNuGet |
before 1.29.1, plus listed versions 0.1.0-preview0.1.1-preview0.1.2-preview0.1.3-preview0.10.0-preview Show 45 moreShow less0.11.0-preview0.11.1-preview0.2.0-preview0.2.1-preview0.3.0-preview0.4.0-preview0.5.0-preview0.5.1-preview0.6.0-preview0.7.1-preview0.8.3-preview0.9.0-preview1.0.01.0.11.1.01.1.11.1.21.1.31.10.01.10.11.11.01.11.11.12.01.13.01.14.01.15.01.16.01.17.01.18.01.19.01.19.11.2.01.2.11.20.01.21.01.22.01.22.11.22.21.22.31.23.01.24.01.24.11.24.21.24.31.25.1 |
1.29.1 |
Microsoft.OpenApi.Kiota.BuilderNuGet |
before 1.29.1, plus listed versions 0.2.0-preview0.3.0-preview0.4.0-preview0.5.0-preview0.5.1-preview Show 41 moreShow less0.6.0-preview0.7.1-preview1.0.01.0.11.1.01.1.11.1.21.1.31.10.01.10.11.11.01.11.11.12.01.13.01.14.01.15.01.16.01.17.01.18.01.19.01.19.11.2.01.2.11.20.01.21.01.22.01.22.11.22.21.22.31.23.01.3.01.4.01.5.01.5.11.6.11.7.01.8.01.8.11.8.21.9.01.9.1 |
1.29.1 |
History
| Recorded | Changed | Sources |
|---|---|---|
| facts | OSV | |
| first indexed | CVE List, EUVD, GitHub Advisories, NVD, OSV |
Dates are when Every CVE recorded each change. Upstream dates may differ.
In short
CVE-2026-59859 is a high vulnerability (CVSS 8.7) in Microsoft Kiota, published July 16, 2026. No source lists public exploit code. EPSS puts the chance of exploitation in the next 30 days at 1.38%, the 72nd percentile. Fixed in Microsoft.OpenApi.Kiota 1.32.4.
References
github.com/microsoft/kiota/security/advisories/GHSA-jqwh-526h-c92j
github.com/microsoft/kiota/pull/7863
github.com/microsoft/kiota/commit/5e2a211ac4261988fbdc72c3b268596ea8837b87
github.com/microsoft/kiota/releases/tag/v1.32.4
nvd.nist.gov/vuln/detail/CVE-2026-59859
github.com/advisories/GHSA-jqwh-526h-c92j
github.com/CVEProject/cvelistV5/tree/main/cves/2026/59xxx/CVE-2026-59859.json
github.com/microsoft/kiota
Left out here: 16 versions. The JSON record has them.