Description
Kiota is an OpenAPI based HTTP Client code generator. Prior to 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.32.5 by GenerationConfiguration.SanitizeClientClassName and SanitizeClientNamespaceName.
Published: 2026-07-16
Score: 9.3 Critical
EPSS: 1.4% Low
KEV: No
Impact: n/a
Action: n/a
AI Analysis

Impact

The vulnerability is in Kiota, Microsoft’s OpenAPI‑based code generator. When Kiota processes an OpenAPI document that contains x-ms-kiota-info for clientClassName and clientNamespaceName without sanitizing these values, it writes files using the raw names and injects them into generated class and namespace declarations. An attacker can craft a malicious specification that causes Kiota to write arbitrary files outside the intended output directory and embed malicious code in the generated sources, potentially leading to code execution if the generated code is compiled and run. The flaw maps to CWE‑22 (Improper Restriction of Operations within the Bounds of a Memory Buffer) and CWE‑94 (Improper Control of Generation of Code).

Affected Systems

All instances of Microsoft Kiota older than version 1.32.5 are affected. The issue manifests when the generate command is run without specifying a class name (-c or --class-name), allowing unfiltered values from the specification to dictate output paths and class names. Users who generate client code from untrusted or user‑supplied OpenAPI files with these unescaped fields are at risk.

Risk and Exploitability

The CVSS score of 9.3 reflects the high severity of arbitrary file write coupled with code injection. EPSS score of 1% indicates a very low but nonzero probability that attackers are actively exploiting this vulnerability. The lack of input sanitization means the attack can be achieved by any local user running Kiota with a crafted specification. The vulnerability is not yet listed in the CISA KEV catalog. The attack vector is local: an adversary who can influence the OpenAPI spec and has permission to run Kiota can write arbitrary files and inject code, which may lead to execution of malicious payloads when the generated code is later compiled or executed.

Generated by OpenCVE AI on July 31, 2026 at 01:53 UTC.

Remediation

No vendor fix or workaround currently provided.

OpenCVE Recommended Actions

  • Upgrade Microsoft Kiota to version 1.32.5 or later, which includes sanitization of clientClassName and clientNamespaceName.
  • If an upgrade cannot be performed instantly, restrict the file system permissions of the account that runs Kiota so that it can write only to the designated output directory, preventing creation of files outside that path.
  • Validate any OpenAPI specification before it is fed into Kiota, ensuring that clientClassName and clientNamespaceName values are derived from trusted sources and contain no directory traversal or code injection patterns.

Generated by OpenCVE AI on July 31, 2026 at 01:53 UTC.

Tracking

Sign in to view the affected projects.

Advisories
Source ID Title
Github GHSA Github GHSA GHSA-4vv7-jj25-4gh6 Microsoft Kiota: Arbitrary file write + code-injection via x-ms-kiota-info clientClassName and clientNamespaceName
History

Wed, 29 Jul 2026 19:30:00 +0000

Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'yes', 'Exploitation': 'none', 'Technical Impact': 'total'}, 'version': '2.0.3'}


Thu, 16 Jul 2026 16:45:00 +0000

Type Values Removed Values Added
First Time appeared Microsoft
Microsoft kiota
Vendors & Products Microsoft
Microsoft kiota

Thu, 16 Jul 2026 15:30:00 +0000

Type Values Removed Values Added
Description Kiota is an OpenAPI based HTTP Client code generator. Prior to 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.32.5 by GenerationConfiguration.SanitizeClientClassName and SanitizeClientNamespaceName.
Title Kiota: Arbitrary file write + code-injection via x-ms-kiota-info clientClassName and clientNamespaceName
Weaknesses CWE-22
CWE-94
References
Metrics cvssV4_0

{'score': 9.3, 'vector': 'CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N'}


cve-icon MITRE

Status: PUBLISHED

Assigner: GitHub_M

Published:

Updated: 2026-07-29T18:26:17.236Z

Reserved: 2026-07-07T15:41:53.607Z

Link: CVE-2026-59866

cve-icon Vulnrichment

Updated: 2026-07-29T18:23:58.959Z

cve-icon NVD

No data.

cve-icon Redhat

No data.

cve-icon OpenCVE Enrichment

Updated: 2026-07-31T02:00:05Z

Weaknesses
  • CWE-22

    Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')

  • CWE-94

    Improper Control of Generation of Code ('Code Injection')