CVE-2026-41134
C# vulnerability analysis and mitigation

Overview

CVE-2026-41134 is a code-generation literal injection vulnerability in Microsoft Kiota, an OpenAPI-based HTTP client code generator. All versions prior to 1.31.1 are affected across multiple writer sinks, including serialization/deserialization keys, path/query parameter mappings, URL template metadata, enum/property metadata, and default value emission. When malicious values from an OpenAPI description are emitted into generated source code without context-appropriate escaping, an attacker can break out of string literals and inject arbitrary code into generated clients. The vulnerability was published on April 22, 2026, with a patch released in version 1.31.1. It carries a CVSS v3.1 base score of 7.8 (High) and a CVSS v4.0 base score of 7.3 (High) (GitHub Advisory, Red Hat).

Technical details

The root cause is classified as CWE-94 (Improper Control of Generation of Code / Code Injection). Kiota fails to apply context-appropriate escaping when emitting values from an OpenAPI description into generated source code, allowing string literal boundaries to be broken. An attacker who controls or can tamper with an OpenAPI description used for code generation can embed payloads such as "\";\ throw new System.Exception(\"injected\"); //" as a default value, which Kiota then writes verbatim into generated C# (or other language) client code. The attack vector is local (the malicious OpenAPI file must be consumed by the generator), requires low attack complexity, and exploitation requires no privileges but does require the victim to use the attacker-controlled or tampered OpenAPI description as input to Kiota (GitHub Advisory).

Impact

Successful exploitation results in arbitrary code injection into generated client applications, which executes when those clients are compiled and run, leading to high confidentiality, integrity, and availability impacts on the systems running the generated code. An attacker could achieve remote code execution within the context of the application using the generated client, potentially enabling data exfiltration, privilege escalation, or further lateral movement within the affected environment. The scope of impact is limited to systems that compile and execute the generated client code, but any downstream consumer of a compromised generated client is at risk (GitHub Advisory, Red Hat).

Exploitability

A conceptual proof-of-concept exploit example is included in the official GitHub Security Advisory, demonstrating how a malicious OpenAPI default value can inject code into generated C# output; however, this is illustrative only and not a working exploit (GitHub Advisory). There is no evidence of active in-the-wild exploitation at this time, and no threat actor attribution has been reported. The EPSS score is approximately 0.051% (very low probability of exploitation in the near term). The vulnerability is not listed in the CISA Known Exploited Vulnerabilities (KEV) catalog. Exploitation is practically constrained to scenarios where an attacker can supply or tamper with the OpenAPI description used for code generation.

Exploitation steps

  1. Identify a target: Determine that a development team or CI/CD pipeline uses Kiota (versions < 1.31.1) to generate HTTP client code from an OpenAPI description.
  2. Craft a malicious OpenAPI description: Modify or create an OpenAPI description containing a malicious payload in a vulnerable field, such as a property default value. Example fragment:
components:
  schemas:
    User:
      type: object
      properties:
        displayName:
          type: string
          default: "\";\ throw new System.Exception(\"injected\"); //"
  1. Deliver the malicious OpenAPI description: Supply the tampered OpenAPI file to the target's Kiota code generation process — either by compromising the upstream API description source, performing a supply chain attack, or social engineering the developer into using the malicious file.
  2. Trigger code generation: The victim runs Kiota against the malicious OpenAPI description, causing the injected payload to be written verbatim into the generated client source code (e.g., a C# constructor).
  3. Achieve code execution: When the generated client is compiled and executed, the injected statements run in the context of the application, enabling arbitrary code execution (GitHub Advisory).

Indicators of compromise

  • File System: Generated client source files (e.g., .cs, .ts, .java) containing unexpected code constructs such as throw new Exception(...), eval(...), or other executable statements outside of normal Kiota-generated patterns; unusual or unexpected statements in constructors or property initializers of generated model classes.
  • Build/CI Logs: Compilation errors or warnings referencing unexpected syntax in generated files; build pipeline logs showing Kiota being invoked against external or unverified OpenAPI description URLs.
  • Source Control: Unexpected changes to generated client files in version control that introduce executable statements not consistent with API schema changes; modifications to OpenAPI description files (.yaml/.json) that include unusual string values with escape sequences in default values, enum names, or parameter names.
  • Runtime: Unexpected exceptions, process spawning, or network connections originating from applications using Kiota-generated clients, particularly shortly after a code regeneration event (GitHub Advisory).

Mitigation and workarounds

Upgrade Kiota to version 1.31.1 or later, which applies context-appropriate escaping across all affected writer sinks. After upgrading, regenerate and refresh all existing generated clients using kiota update to replace any previously generated vulnerable code with hardened output. As an interim risk reduction measure, only generate clients from trusted, integrity-protected OpenAPI descriptions, and implement controls (e.g., checksum verification, access controls on API description sources) to prevent tampering. Avoid consuming OpenAPI descriptions from untrusted or unverified external sources (GitHub Advisory).

Community reactions

The vulnerability was discovered and responsibly disclosed by researcher Thanatos Tian (PolyU), who is acknowledged in the official GitHub Security Advisory. Red Hat has also tracked this CVE in their security advisory database. No significant broader media coverage or notable social media discussion has been identified beyond standard vulnerability tracking and aggregation sites (GitHub Advisory, Red Hat).

Additional resources


SourceThis report was generated using AI

Related C# vulnerabilities:

CVE ID

Severity

Score

Technologies

Component name

CISA KEV exploit

Has fix

Published date

GHSA-pfvm-w89x-94jwHIGH7.5
  • C# logoC#
  • SIPSorcery
NoYesAug 12, 2026
CVE-2026-48798HIGH7.1
  • C# logoC#
  • SSH.NET
NoYesAug 18, 2026
CVE-2026-54570MEDIUM6.9
  • C# logoC#
  • AngleSharp
NoYesAug 18, 2026
CVE-2026-73851MEDIUM6.1
  • C# logoC#
  • Microsoft.OpenApi.Kiota
NoYesAug 17, 2026
CVE-2026-48796MEDIUM5.3
  • C# logoC#
  • CefSharp.Common
NoYesAug 18, 2026

Free Vulnerability Assessment

Benchmark your Cloud Security Posture

Evaluate your cloud security practices across 9 security domains to benchmark your risk level and identify gaps in your defenses.

Request assessment

Get a personalized demo

Ready to see Wiz in action?

"Best User Experience I have ever seen, provides full visibility to cloud workloads."
David EstlickCISO
"Wiz provides a single pane of glass to see what is going on in our cloud environments."
Adam FletcherChief Security Officer
"We know that if Wiz identifies something as critical, it actually is."
Greg PoniatowskiHead of Threat and Vulnerability Management