CVE-2026-59862: 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.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.
AI Analysis
Technical Summary
Microsoft Kiota, an OpenAPI-based HTTP client code generator, had a vulnerability in its Python generator before version 1.32.0. Specifically, attacker-controlled enum value descriptions from x-ms-enum.values[].description flowed through KiotaBuilder.SetEnumOptions into Documentation.DescriptionTemplate and PythonConventionService.RemoveInvalidDescriptionCharacters without proper newline sanitization. This allowed generated inline comments to be split, enabling execution of attacker-controlled Python code at module scope when the generated modules were imported. The vulnerability is classified as CWE-94 (Improper Control of Generation of Code) and has a CVSS 3.1 base score of 7.5 (high). The issue is resolved in Kiota version 1.32.0.
Potential Impact
An attacker who can control enum value descriptions in the OpenAPI specification used by Kiota's Python generator can inject and execute arbitrary Python code at module import time. This can lead to arbitrary code execution in the environment where the generated Python modules are imported. The vulnerability does not impact confidentiality or integrity directly but results in a high impact on availability due to potential arbitrary code execution.
Mitigation Recommendations
Upgrade to Kiota version 1.32.0 or later, where this vulnerability is fixed. There is no indication of any temporary workaround or alternative mitigation. Users should ensure they do not use affected versions of Kiota's Python generator in production environments.
CVE-2026-59862: 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.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.
CVSS v3.1
Score 7.5high
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
Microsoft Kiota, an OpenAPI-based HTTP client code generator, had a vulnerability in its Python generator before version 1.32.0. Specifically, attacker-controlled enum value descriptions from x-ms-enum.values[].description flowed through KiotaBuilder.SetEnumOptions into Documentation.DescriptionTemplate and PythonConventionService.RemoveInvalidDescriptionCharacters without proper newline sanitization. This allowed generated inline comments to be split, enabling execution of attacker-controlled Python code at module scope when the generated modules were imported. The vulnerability is classified as CWE-94 (Improper Control of Generation of Code) and has a CVSS 3.1 base score of 7.5 (high). The issue is resolved in Kiota version 1.32.0.
Potential Impact
An attacker who can control enum value descriptions in the OpenAPI specification used by Kiota's Python generator can inject and execute arbitrary Python code at module import time. This can lead to arbitrary code execution in the environment where the generated Python modules are imported. The vulnerability does not impact confidentiality or integrity directly but results in a high impact on availability due to potential arbitrary code execution.
Mitigation Recommendations
Upgrade to Kiota version 1.32.0 or later, where this vulnerability is fixed. There is no indication of any temporary workaround or alternative mitigation. Users should ensure they do not use affected versions of Kiota's Python generator in production environments.
Technical Details
- Data Version
- 5.2
- Assigner Short Name
- GitHub_M
- Date Reserved
- 2026-07-07T15:41:53.606Z
- Cvss Version
- 3.1
- State
- PUBLISHED
- Remediation Level
- null
Threat ID: 6a58ef3568715ace43306155
Added to database: 07/16/2026, 14:48:21 UTC
Last enriched: 07/16/2026, 15:02:41 UTC
Last updated: 07/16/2026, 20:48:45 UTC
Views: 8
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.