Alta

Microsoft Kiota: Arbitrary file write + code-injection via x-ms-kiota-info clientClassName and clientNamespaceName

  • Publicada: 24.07.2026
  • Actualizado: 11.10.2026 11:23

Summary

Microsoft Kiota emitted the x-ms-kiota-info extension's clientClassName or clientNamespaceName value raw, with no identifier or path sanitization, as both the generated client's class/namespace name and part of the generated output path. When kiota generate is run without -c/--class-name — the zero-config workflow that x-ms-kiota-info is explicitly designed for (the API provider supplies the names in the description so consumers don't have to) — an attacker who controls or tampers with the OpenAPI description could therefore:

  • (CWE-22) write the generated source file to a path outside the -o output directory — e.g. clientClassName: "/var/www/html/shell"; and
  • (CWE-94) inject arbitrary text into the generated class/namespace declaration, corrupting the generated client.

Confirmed on Kiota 1.32.4 (the self-contained linux-x64 release binary), i.e. after the earlier writer-sink hardening — that fix escaped property/enum/default/serialization sinks but never sanitized the provider-supplied clientClassName / clientNamespaceName.

Details

clientClassName reached two unsanitized sinks (observed in the generated C#; the same raw emission occurred for Java, Go, TypeScript, Python, and PHP):

# output FILENAME (CWE-22): clientClassName flows into the file path
clientClassName: "/abs/path/PWNED"   ->   /abs/path/PWNED.cs   (written outside -o)

# class declaration (CWE-94): clientClassName flows verbatim into the type declaration
clientClassName: 'Pwn { } public class INJECTED { } public partial class RealClient'
   ->  public partial class Pwn { } public class INJECTED { } public partial class RealClient : ... { }

clientNamespaceName reached the analogous namespace/path sinks.

Impact

A developer or CI host generating a client from an attacker-controlled or compromised OpenAPI description (without -c) could create/overwrite a generated source file at an attacker-influenced path and emit attacker-controlled text into the generated client.

This does not reach clean remote code execution: because clientClassName is reused verbatim at multiple sites (the class name and the constructor name), injected code cannot be made to compile — it breaks the build. So the code-injection vector is a generation/build-corruption (integrity/DoS), and the high-severity primitive is the file write. CWE-22 / CWE-94.

Patches

Fixed in 1.29.1 and 1.32.5 (https://github.com/microsoft/kiota/pull/7884). clientClassName and clientNamespaceName sourced from x-ms-kiota-info are now sanitized before use: GenerationConfiguration.SanitizeClientClassName strips any character outside [A-Za-z0-9_] and any invalid leading character (falling back to ApiClient), and SanitizeClientNamespaceName restricts to [A-Za-z0-9._-], collapses consecutive dots, strips invalid leading characters (falling back to ApiSdk). This removes path separators, drive/colon, .., quotes, and braces, so the values can no longer influence the output path or inject into the declaration.

Remediation

Upgrade to Kiota 1.29.1, 1.32.5, or later and regenerate affected clients.

Software afectado

Haz clic en una tecnología para ver todas sus vulnerabilidades.

PlataformaPaqueteVersiones vulnerablesCorregida en
.NET (NuGet) Microsoft.OpenApi.Kiota >= 1.30.0, < 1.32.5, < 1.29.1 1.32.5, 1.29.1
.NET (NuGet) Microsoft.OpenApi.Kiota.Builder >= 1.30.0, < 1.32.5, < 1.29.1 1.32.5, 1.29.1

Referencias

Puntuación CVSS -
Vector CVSS
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:A/VC:N/VI:H/VA:L/SC:N/SI:N/SA:N
Debilidad (CWE)
CWE-22, CWE-94
Plataforma
.NET (NuGet)
Paquete
Microsoft.OpenApi.Kiota, Microsoft.OpenApi.Kiota.Builder
Publicada
24.07.2026
Actualizado
11.10.2026 11:23

Fuentes y licencias

OSV / GitHub Advisory Database - GHSA-4vv7-jj25-4gh6 - CC BY 4.0

Historial de vulnerabilidades: Microsoft.OpenApi.Kiota.Builder

Todas las vulnerabilidades publicadas de este paquete (.NET (NuGet)), de la más reciente a la más antigua. Muestra si es un fallo aislado o un paquete que hay que vigilar.

Todas (12) en el archivo
Entradas en total
12
Primera → última
04.2026 10.2026
Sin corrección
0
Explotada en ataques
0

Distribución por gravedad

  • Crítica 2
  • Alta 9
  • Baja 1

Divulgaciones por año

  1. 2026: 12
Gravedad:
  1. Microsoft Kiota: Arbitrary file write + code-injection via x-ms-kiota-info clientClassName and clientNamespaceName esta entrada
    Alta CVE-2026-59866 >= 1.30.0, < 1.32.5, < 1.29.1 1.32.5, 1.29.1
  2. Crítica CVE-2026-59865 >= 1.30.0, < 1.32.5, < 1.29.1 1.32.5, 1.29.1
  3. Alta CVE-2026-59863 >= 1.30.0, < 1.32.5, < 1.29.1 1.32.5, 1.29.1
  4. Alta · 7.1 CVE-2026-59867 >= 1.30.0, < 1.32.5, < 1.29.1 1.32.5, 1.29.1
  5. Crítica CVE-2026-59864 >= 1.30.0, < 1.32.5, < 1.29.1 1.32.5, 1.29.1
  6. Alta CVE-2026-59859 >= 1.30.0, < 1.32.4, < 1.29.1 1.32.4, 1.29.1
  7. Alta · 7.5 CVE-2026-59862 >= 1.30.0, < 1.32.0, < 1.29.1 1.32.0, 1.29.1
  8. Alta · 7.5 CVE-2026-59861 >= 1.30.0, < 1.32.0, < 1.29.1 1.32.0, 1.29.1
  9. Alta CVE-2026-59860 >= 1.30.0, < 1.32.3, < 1.29.1 1.32.3, 1.29.1
  10. Alta · 0.0 CVE-2026-41134 >= 1.30.0, < 1.31.1, < 1.29.1 1.31.1, 1.29.1

Identifica las vulnerabilidades de tu aplicación

Con la integración de DockRay y el inventario de software activado, DockRay compara las versiones notificadas de los componentes con las vulnerabilidades conocidas y avisa de las coincidencias confirmadas. La cobertura depende de la tecnología compatible y de los avisos disponibles.

Conectar tu aplicación
Newsletter DockRay

La seguridad de tus aplicaciones en tu correo

Vulnerabilidades importantes, recomendaciones concretas y consejos prácticos para tus aplicaciones. Elige tus tecnologías y sigue lo que importa para tu proyecto.

  • Un resumen diario de nuevas vulnerabilidades, también las críticas.
  • Avisos sobre actualizaciones importantes.
  • Consejos prácticos sobre seguridad y monitorización de aplicaciones.

Déjalo vacío para recibir avisos de todas las tecnologías.

Suscripción gratuita. Date de baja con un clic en cualquier correo.