Every CVE Search/ Get API key

CVE-2026-59862

Kiota: Code Generation Literal Injection in the Python Generator

7.5 HighFix available

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.

Attack profile

How easy it is to exploit

Attack vector
Network
Complexity
Low
Privileges needed
None
User interaction
None

What an attacker can affect

Confidentiality
None
Integrity
None
Availability
High

Exploit likelihood

1.38%Up 0.4 points since Jul 17, 2026
90%50%10%1%

What each source reports

CVE List Score used 7.5

Kiota: Code Generation Literal Injection in the Python Generator

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.

Record
CVE-2026-59862
CVSS 3.1
7.5 HighCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Weakness
CWE-94
Updated
2026-11-02
EUVDEUVD-2026-44927 7.5

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.

Record
EUVD-2026-44927
CVSS 3.1
7.5 HighCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Updated
2026-11-02
GitHub AdvisoriesGHSA-7f3j-j7jj-r3vr 7.5

Microsoft Kiota: Code Generation Literal Injection in Kiota Python Generator

Code Generation Literal Injection in Kiota Python Generator Leads to Arbitrary Code Execution at Import Time.

The Kiota Python code generator is vulnerable to a code generation literal injection issue when processing malicious or untrusted OpenAPI specifications. Specifically, attacker-controlled enum value descriptions from x-ms-enum.values[].description can flow into generated Python files without newline sanitization, allowing injected content to escape a comment context and execute at module scope when the generated module is imported.

This issue requires user interaction in the form of generating a client from a malicious specification and importing the generated code, which is a common development and CI workflow.

Impact

A malicious OpenAPI specification can cause arbitrary Python code to be emitted into generated model files. The payload executes when the affected module is imported.

Potential impact includes

Credential theft from developer or CI environments Exfiltration of environment variables and secrets Source code disclosure Persistence via regenerated backdoored client output Who is impacted Developers generating Python SDKs from external or untrusted OpenAPI specs Teams with CI/CD automation that regenerates clients from remote specification URLs Any environment importing generated Python modules before manual review Vulnerability details Two gaps combine to enable exploitation:

Enum description cleanup gap

In KiotaBuilder.SetEnumOptions, enum option descriptions are assigned to Documentation.DescriptionTemplate without CleanupDescription on this path, allowing control characters such as newlines to propagate.

Python description sanitization gap

PythonConventionService.RemoveInvalidDescriptionCharacters escapes backslashes and triple quotes but did not remove carriage return/newline characters, unlike some other language convention services.

Exploit path

Malicious newline in x-ms-enum description is emitted through enum writing path. Generated inline comment output is split by newline. Subsequent attacker-controlled line lands at module scope in generated .py file. Importing the module executes the injected code.

Attack vectors

OpenAPI specifications hosted at attacker-controlled URLs Supply-chain scenarios where third-party specs are consumed automatically CI pipelines that generate and then import or test generated Python clients

Patches

https://github.com/microsoft/kiota/pull/7735

Workarounds

If you cannot upgrade immediately:

Only generate from trusted, internally controlled OpenAPI specification sources. Disable or gate automatic generation from remote specs in CI/CD. Add validation/sanitization for x-ms-enum descriptions before generation. Review generated Python files for suspicious top-level statements near enum/model declarations. Run generation and validation in isolated environments without access to production secrets.

Remediation

Upgrade to Kiota 1.29.1, 1.32.0, or later.

Regenerate existing Python clients to replace previously generated vulnerable output.

Recommended validation after upgrade

Regenerate from the same spec used in proof-of-concept testing Confirm malicious multi-line enum descriptions no longer produce executable top-level output

Record
GHSA-7f3j-j7jj-r3vr
CVSS 3.1
7.5 HighCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Weakness
CWE-94
Updated
2026-11-02
NVD 7.5

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.

Record
CVE-2026-59862
CVSS 3.1
7.5 HighCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Weakness
CWE-94
Updated
2026-11-02
OSV 7.5

Kiota: Code Generation Literal Injection in the Python Generator

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.

Record
CVE-2026-59862
CVSS 3.1
7.5 HighCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Weakness
CWE-94
Updated
2026-11-07
OSVGHSA-7f3j-j7jj-r3vr 7.5

Microsoft Kiota: Code Generation Literal Injection in Kiota Python Generator

Code Generation Literal Injection in Kiota Python Generator Leads to Arbitrary Code Execution at Import Time.

The Kiota Python code generator is vulnerable to a code generation literal injection issue when processing malicious or untrusted OpenAPI specifications. Specifically, attacker-controlled enum value descriptions from x-ms-enum.values[].description can flow into generated Python files without newline sanitization, allowing injected content to escape a comment context and execute at module scope when the generated module is imported.

This issue requires user interaction in the form of generating a client from a malicious specification and importing the generated code, which is a common development and CI workflow.

Impact

A malicious OpenAPI specification can cause arbitrary Python code to be emitted into generated model files. The payload executes when the affected module is imported.

Potential impact includes

Credential theft from developer or CI environments Exfiltration of environment variables and secrets Source code disclosure Persistence via regenerated backdoored client output Who is impacted Developers generating Python SDKs from external or untrusted OpenAPI specs Teams with CI/CD automation that regenerates clients from remote specification URLs Any environment importing generated Python modules before manual review Vulnerability details Two gaps combine to enable exploitation:

Enum description cleanup gap

In KiotaBuilder.SetEnumOptions, enum option descriptions are assigned to Documentation.DescriptionTemplate without CleanupDescription on this path, allowing control characters such as newlines to propagate.

Python description sanitization gap

PythonConventionService.RemoveInvalidDescriptionCharacters escapes backslashes and triple quotes but did not remove carriage return/newline characters, unlike some other language convention services.

Exploit path

Malicious newline in x-ms-enum description is emitted through enum writing path. Generated inline comment output is split by newline. Subsequent attacker-controlled line lands at module scope in generated .py file. Importing the module executes the injected code.

Attack vectors

OpenAPI specifications hosted at attacker-controlled URLs Supply-chain scenarios where third-party specs are consumed automatically CI pipelines that generate and then import or test generated Python clients

Patches

https://github.com/microsoft/kiota/pull/7735

Workarounds

If you cannot upgrade immediately:

Only generate from trusted, internally controlled OpenAPI specification sources. Disable or gate automatic generation from remote specs in CI/CD. Add validation/sanitization for x-ms-enum descriptions before generation. Review generated Python files for suspicious top-level statements near enum/model declarations. Run generation and validation in isolated environments without access to production secrets.

Remediation

Upgrade to Kiota 1.29.1, 1.32.0, or later.

Regenerate existing Python clients to replace previously generated vulnerable output.

Recommended validation after upgrade

Regenerate from the same spec used in proof-of-concept testing Confirm malicious multi-line enum descriptions no longer produce executable top-level output

Record
GHSA-7f3j-j7jj-r3vr
CVSS 3.1
7.5 HighCVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:H
Weakness
CWE-94
Updated
2026-11-02

Affected products

Affected packages

Affected packages
PackageAffectedFixed
Microsoft.OpenAPI.Kiota
NuGet
1.30.0 up to 1.32.0
1.32.0
Microsoft.OpenAPI.Kiota.Builder
NuGet
1.30.0 up to 1.32.0
1.32.0
Microsoft.OpenApi.Kiota
NuGet
before 1.29.1
1.29.1
Microsoft.OpenApi.Kiota.Builder
NuGet
before 1.29.1
1.29.1
Microsoft.OpenAPI.Kiota
NuGet
1.30.0 up to 1.32.0, plus listed versions
1.31.01.31.1
1.32.0
Microsoft.OpenApi.Kiota
NuGet
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 less
0.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.Builder
NuGet
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 less
0.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

History
RecordedChangedSources
factsOSV
first indexedCVE List, EUVD, GitHub Advisories, NVD, OSV

Dates are when Every CVE recorded each change. Upstream dates may differ.

In short

CVE-2026-59862 is a high vulnerability (CVSS 7.5) 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.0.

References

This page doesn't list everything

Left out here: 16 versions. The JSON record has them.

MoveEnter Open