Kiota: Code Generation Literal Injection in the Python Generator
microsoft kiota
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Microsoft.OpenAPI.Kiota NuGet |
|
|
| Microsoft.OpenAPI.Kiota.Builder NuGet |
|
|
| Microsoft.OpenApi.Kiota |
microsoft kiota
| Product | Affected | Fixed in |
|---|---|---|
| Microsoft.OpenAPI.Kiota NuGet |
|
|
| Microsoft.OpenAPI.Kiota.Builder NuGet |
|
|
| Microsoft.OpenApi.Kiota |
|
|
| Microsoft.OpenApi.Kiota.Builder NuGet |
|
|
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.
From the CVE record · GitHub_M
Kiota's Python generator did not sanitize newlines in attacker-controlled enum value descriptions. If a developer generated Python code from a crafted OpenAPI description, attacker-controlled code could execute when the generated module was imported. The input does not specify an authentication requirement.
Check NuGet Microsoft.OpenAPI.Kiota and Microsoft.OpenAPI.Kiota.Builder versions >=1.30.0 and <1.32.0, and Microsoft.OpenApi.Kiota and Microsoft.OpenApi.Kiota.Builder versions <1.29.1.