CVE-2026-59859

Kiota: Code Generation Literal Injection in the PHP Generator

Published Jul 16, 2026 CVSS 4.0 · 8.7 High EPSS 1.4% KEV · Not listed
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.

Analysis

AI-generated

Technical impact

The vulnerability is a code generation literal injection identified as CWE‑94 in Kiota's PHP generator. Prior to 1.29.1 and 1.32.4, the generator inserted OpenAPI schema strings directly into double‑quoted PHP literals without escaping dollar signs. Based on the description, it is inferred that an attacker supplies a crafted OpenAPI specification that the generator processes, allowing PHP interpolation constructs such as ${…}, $var, or {$obj->prop} to be injected into the generated code and executed. Consequently, the injected PHP code runs within the environment that loads or executes the generated classes, leading to remote code execution.

Affected Systems

Affected vendors and products: Microsoft Kiota, the OpenAPI‑based HTTP client code generator. Versions prior to 1.29.1 and prior to 1.32.4 are vulnerable; the fix is available from release 1.29.1 and 1.32.4 onward. Therefore, any installation of Kiota older than 1.29.1 or between 1.29.1 and 1.32.3 that processes potentially untrusted OpenAPI definitions is impacted.

Risk and Exploitability

The likely attack vector is an attacker supplying a crafted OpenAPI specification to the PHP generator. Based on the description, it is inferred that this allows the injection of PHP interpolation constructs into double‑quoted literals, leading to arbitrary code execution. Risk assessment shows a CVSS score of 8.7, indicating high severity. The EPSS score is 1%, suggesting a very low but nonzero exploitation probability, and the vulnerability is not listed in CISA’s KEV catalog. Attack requires the generator to process untrusted OpenAPI definitions, which is typically a developer‑level or local effect, but can also be leveraged in automated build pipelines that consume untrusted specs. If not mitigated, the impact would be code execution on the environment where the generated PHP code runs. Therefore, organizations should consider the risk high when the generator is used in production environments.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade Kiota to 1.29.1 or later, ensuring that 1.32.4 or newer is used for best support.
  • Ensure that any OpenAPI specifications fed into the generator originate from trusted sources; perform input validation or restrict the generator to trusted environments to prevent injection.
  • If an upgrade is not immediately feasible, conduct a manual review or strip dollar signs from generated strings, or use a custom sanitization layer that escapes interpolation sequences before code generation.

Generated by OpenCVE AI on August 17, 2026 at 20:24 UTC.

Tracking

Sign in to view the affected projects.

Advisories

Source ID Title
Github GHSA Github GHSA GHSA-jqwh-526h-c92j Microsoft Kiota: Code Generation Literal Injection in Kiota PHP Generator
History
Type Values Removed Values Added
Description Kiota is an OpenAPI based HTTP Client code generator. Prior to 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.32.4. 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.
Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'none', 'Technical Impact': 'total'}, 'version': '2.0.3'}

Type Values Removed Values Added
First Time appeared Microsoft
Microsoft kiota
Vendors & Products Microsoft
Microsoft kiota
Type Values Removed Values Added
Description Kiota is an OpenAPI based HTTP Client code generator. Prior to 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.32.4.
Title Kiota: Code Generation Literal Injection in the PHP Generator
Weaknesses CWE-94
References
Metrics cvssV4_0

{'score': 8.7, 'vector': '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'}

Weaknesses
  • CWE-94

    Improper Control of Generation of Code ('Code Injection')

Sources

Status
PUBLISHED
Assigner
GitHub_M
Published
Updated
Aug 17, 2026, 3:02 PM
Reserved
Jul 7, 2026, 3:41 PM
Status
Deferred
Published
Jul 16, 2026, 3:16 PM
Modified
Oct 24, 2026, 9:10 PM