Skip to main content
Press slash or control plus K to focus the search. Use the arrow keys to navigate results and press enter to open a threat.
Reconnecting to live updates…
EPSS 1.4%top 30%

CVE-2026-59862: CWE-94: Improper Control of Generation of Code ('Code Injection') in microsoft kiota

0
High
Published: 07/16/2026 (07/16/2026, 14:38:59 UTC)
Source: CVE Database V5
Vendor/Project: microsoft
Product: kiota

Description

Kiota is an OpenAPI based HTTP Client code generator. Prior to 1.29.1 and 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.29.1 and 1.32.0.

CVSS v3.1

Score 7.5high

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
None
Availability
High
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H

Affected software

kiota
pkg:pypi/kiota
Affected versions
<1.32.0

Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.

AI-Powered Analysis

Machine-generated threat intelligence

AILast updated: 08/17/2026, 16:25:07 UTC

Technical Analysis

The Kiota Python generator improperly handles enum value descriptions from the x-ms-enum.values[].description field in OpenAPI specifications. Specifically, newline characters are not sanitized, allowing attacker-controlled input to break out of comment contexts and inject executable Python code at the module scope. This code executes upon import of the generated Python module. The vulnerability requires user interaction in generating and importing code from a malicious specification, commonly occurring in development or CI workflows. The root cause is twofold: a missing cleanup step for enum descriptions and incomplete sanitization of newline characters in Python code generation. Exploitation vectors include consuming malicious OpenAPI specs from attacker-controlled URLs or supply-chain scenarios. The vendor has released patches in Kiota versions 1.29.1, 1.32.0, and later to address this issue.

Potential Impact

Successful exploitation allows arbitrary Python code execution at import time of generated client modules. This can lead to credential theft, exfiltration of environment variables and secrets, source code disclosure, and persistent backdoors via regenerated client code. The impact primarily affects developers and CI/CD pipelines that generate and import Python SDKs from untrusted or malicious OpenAPI specifications.

Mitigation Recommendations

Upgrade Kiota to version 1.29.1, 1.32.0, or later to apply the official fix. Regenerate any previously generated Python clients to remove vulnerable code. If immediate upgrade is not possible, only generate clients from trusted, internally controlled OpenAPI specifications, disable or gate automatic generation from remote specs in CI/CD pipelines, validate and sanitize x-ms-enum descriptions before generation, and review generated Python files for suspicious top-level code near enum declarations. Run generation and validation in isolated environments without access to production secrets. Confirm after upgrade that malicious multi-line enum descriptions no longer produce executable top-level output.

Pro Console: star threats, build custom feeds, automate alerts via Slack, email & webhooks.Upgrade to Pro

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: 08/17/2026, 16:25:07 UTC

Last updated: 08/30/2026, 22:52:12 UTC

Views: 96

Community Reviews

0 reviews

Crowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.

Sort by
Loading community insights…

Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.

Actions

PRO

Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.

Please log in to the Console to use AI analysis features.

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

Breach by OffSeqOFFSEQFRIENDS — 25% OFF

Check if your credentials are on the dark web

Instant breach scanning across billions of leaked records. Free tier available.

Scan now
OffSeq TrainingCredly Certified

Lead Pen Test Professional

Technical5-day eLearningPECB Accredited
View courses