Description
Kiota is an OpenAPI based HTTP Client code generator. Prior to 1.32.0, Kiota's Python generator let attacker-controlled enum value descriptions from x-ms-enum.values[].description flow through KiotaBuilder.SetEnumOptions into Documentation.DescriptionTemplate and PythonConventionService.RemoveInvalidDescriptionCharacters without newline sanitization, allowing generated inline comments to split and execute attacker-controlled Python code at module scope when generated modules were imported. This issue is fixed in version 1.32.0.
Published: 2026-07-16
Score: 7.5 High
EPSS: 1.0% Low
KEV: No
Impact: n/a
Action: n/a
AI Analysis

Impact

The vulnerability arises when a malicious enum description is injected into Kiota’s Python generator. The input flows directly into documentation templates without sanitizing newlines, enabling attacker-controlled code to appear in inline comments that are executed when the generated module is imported, effectively allowing arbitrary Python code execution.

Affected Systems

The issue affects Microsoft Kiota versions earlier than 1.32.0. Users employing these earlier releases for OpenAPI code generation are susceptible; the fix is provided in Kiota v1.32.0 and later.

Risk and Exploitability

The CVSS score of 7.5 indicates high severity. Because the exploit requires control of the OpenAPI specification used by the generator, the attack vector is local to the build or code generation environment. The EPSS score of 1% indicates a low but nonzero probability of exploitation, and the vulnerability is not listed in CISA KEV, suggesting no publicly documented exploitation at this time. Nonetheless, executing generated code in untrusted environments can lead to compromise of the machine running the generator.

Generated by OpenCVE AI on July 31, 2026 at 01:55 UTC.

Remediation

No vendor fix or workaround currently provided.

OpenCVE Recommended Actions

  • Upgrade Microsoft Kiota to version 1.32.0 or later, where the injection issue is resolved.
  • Run the Kiota code generator in a tightly controlled, low-privilege environment (e.g., a separate CI build container) to limit the impact of potential code execution.
  • If an update cannot be applied immediately, implement input validation to escape or remove newline characters from x-ms-enum.values[].description before it is passed to the template engine, or otherwise patch the generator to sanitize this field.

Generated by OpenCVE AI on July 31, 2026 at 01:55 UTC.

Tracking

Sign in to view the affected projects.

Advisories
Source ID Title
Github GHSA Github GHSA GHSA-7f3j-j7jj-r3vr Microsoft Kiota: Code Generation Literal Injection in Kiota Python Generator
History

Wed, 29 Jul 2026 20:30:00 +0000

Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'yes', 'Exploitation': 'none', 'Technical Impact': 'partial'}, 'version': '2.0.3'}

ssvc

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


Thu, 16 Jul 2026 19:30:00 +0000

Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'yes', 'Exploitation': 'none', 'Technical Impact': 'partial'}, 'version': '2.0.3'}


Thu, 16 Jul 2026 15:45:00 +0000

Type Values Removed Values Added
First Time appeared Microsoft
Microsoft kiota
Vendors & Products Microsoft
Microsoft kiota

Thu, 16 Jul 2026 14:45:00 +0000

Type Values Removed Values Added
Description Kiota is an OpenAPI based HTTP Client code generator. Prior to 1.32.0, Kiota's Python generator let attacker-controlled enum value descriptions from x-ms-enum.values[].description flow through KiotaBuilder.SetEnumOptions into Documentation.DescriptionTemplate and PythonConventionService.RemoveInvalidDescriptionCharacters without newline sanitization, allowing generated inline comments to split and execute attacker-controlled Python code at module scope when generated modules were imported. This issue is fixed in version 1.32.0.
Title Kiota: Code Generation Literal Injection in the Python Generator
Weaknesses CWE-94
References
Metrics cvssV3_1

{'score': 7.5, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H'}


cve-icon MITRE

Status: PUBLISHED

Assigner: GitHub_M

Published:

Updated: 2026-07-29T19:26:43.989Z

Reserved: 2026-07-07T15:41:53.606Z

Link: CVE-2026-59862

cve-icon Vulnrichment

Updated: 2026-07-16T18:10:57.554Z

cve-icon NVD

No data.

cve-icon Redhat

No data.

cve-icon OpenCVE Enrichment

Updated: 2026-07-31T02:00:05Z

Weaknesses
  • CWE-94

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