Description
Refitter is a tool for generating a C# REST API client using the Refit library. Prior to 2.1.2, content-type keys in the content maps of `requestBody/responses` are emitted verbatim into a Refit `[Headers("Accept: <ct>", "Content-Type: <ct>")]` attribute string without escaping quotation marks. A crafted content-type key in an attacker-influenced OpenAPI description survives default validation without `--skip-validation`, breaks out of the attribute string and enclosing interface and namespace, and can introduce a top-level file class while leaving valid generated C#. A `[ModuleInitializer]` method in that class executes attacker code when the generated assembly is loaded at application startup, without requiring a call to the client. The behavior was verified with Refitter 2.0.0 and .NET 8. This issue is fixed in version 2.1.2.
Published: 2026-10-30
Score: 8.6 High
EPSS: n/a
KEV: No
Impact: Remote Code Execution
Action: Immediate Patch
AI Analysis

Impact

Refitter, a C# client generator that uses the Refit library, was found to emit content-type values from OpenAPI specification files directly into generated Refit attributes without escaping quotation marks. An attacker who can supply a crafted OpenAPI document can inject unescaped characters that terminate the attribute string and escape the surrounding code, allowing them to inject a top-level class containing a [ModuleInitializer] method. When the generated assembly is loaded during application startup, that method executes arbitrary attacker code, resulting in remote code execution.

Affected Systems

Applications built with Refitter versions prior to 2.1.2 are impacted. The vulnerability applies to all releases from the beginning of the project up through 2.1.1, including the widely used 2.0.0 and the 2.1.0 series. The affected product is Christian Helle’s Refitter tool, and any software that incorporates generated code from those versions is at risk if it loads the resulting assembly.

Risk and Exploitability

The flaw carries a CVSS score of 8.6, indicating high severity. The exploit explanation shows that an attacker must supply a malicious OpenAPI specification; the attack requires no further network interaction once the code is generated, suggesting a moderate to low exploitation probability in the wild. The vulnerability is not currently listed in the CISA KEV catalog and no public exploit code has been published, but the potential for arbitrary code execution at application launch makes it a serious risk for systems that compile and run Refitter output.

Generated by OpenCVE AI on October 30, 2026 at 23:24 UTC.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade Refitter to version 2.1.2 or later to apply the escape handling fix.
  • Disable or remove the --skip-validation flag and validate OpenAPI specifications before feeding them to Refitter.
  • If upgrading is delayed, inspect generated assemblies for unexpected ModuleInitializer methods and reject any that contain user-supplied values.

Generated by OpenCVE AI on October 30, 2026 at 23:24 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories yet.

History

Fri, 30 Oct 2026 22:30:00 +0000

Type Values Removed Values Added
Description Refitter is a tool for generating a C# REST API client using the Refit library. Prior to 2.1.2, content-type keys in the content maps of `requestBody/responses` are emitted verbatim into a Refit `[Headers("Accept: <ct>", "Content-Type: <ct>")]` attribute string without escaping quotation marks. A crafted content-type key in an attacker-influenced OpenAPI description survives default validation without `--skip-validation`, breaks out of the attribute string and enclosing interface and namespace, and can introduce a top-level file class while leaving valid generated C#. A `[ModuleInitializer]` method in that class executes attacker code when the generated assembly is loaded at application startup, without requiring a call to the client. The behavior was verified with Refitter 2.0.0 and .NET 8. This issue is fixed in version 2.1.2.
Title Refitter: C# source injection through OpenAPI content-type map keys
Weaknesses CWE-116
CWE-94
References
Metrics cvssV4_0

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


Subscriptions

No data.

cve-icon MITRE

Status: PUBLISHED

Assigner: GitHub_M

Published:

Updated: 2026-10-30T22:15:27.846Z

Reserved: 2026-07-16T14:14:24.385Z

Link: CVE-2026-63344

cve-icon Vulnrichment

No data.

cve-icon NVD

Status : Received

Published: 2026-10-30T23:17:13.840

Modified: 2026-10-30T23:17:13.840

Link: CVE-2026-63344

cve-icon Redhat

No data.

cve-icon OpenCVE Enrichment

Updated: 2026-10-30T23:30:15Z

Weaknesses
  • CWE-116

    Improper Encoding or Escaping of Output

  • CWE-94

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