Kiota: Arbitrary file write + code-injection via x-ms-kiota-info clientClassName and clientNamespaceName
microsoft kiota
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| Microsoft.OpenApi.Kiota NuGet |
|
|
| Microsoft.OpenApi.Kiota.Builder NuGet |
|
microsoft kiota
| Product | Affected | Fixed in |
|---|---|---|
| Microsoft.OpenApi.Kiota NuGet |
|
|
| Microsoft.OpenApi.Kiota.Builder NuGet |
|
|
Kiota is an OpenAPI based HTTP Client code generator. Prior to 1.29.1 and 1.32.5, Kiota emitted x-ms-kiota-info clientClassName and clientNamespaceName values without identifier or path sanitization as both generated client class or namespace names and generated output path components when `kiota generate` ran without -c/--class-name, allowing an attacker-controlled or compromised OpenAPI description to write generated source outside the -o output directory and inject arbitrary text into generated class or namespace declarations. This issue is fixed in version 1.29.1 and 1.32.5 by GenerationConfiguration.SanitizeClientClassName and SanitizeClientNamespaceName.
From the CVE record · GitHub_M
Kiota uses unsanitized client class and namespace names from OpenAPI descriptions when `kiota generate` runs without `-c` or `--class-name`. An attacker-controlled or compromised description can cause generated source to be written outside the output directory and inject arbitrary text into generated declarations; exploitation requires generating a client from that description.
Teams using the NuGet packages Microsoft.OpenApi.Kiota or Microsoft.OpenApi.Kiota.Builder in versions below 1.29.1 or from 1.30.0 up to, but not including, 1.32.5 should check their installations.