Description
Refitter is a tool for generating a C# REST API client using the Refit library. Prior to 2.1.2, the header parameter name in `parameters[].name` with `in: header` is emitted verbatim into a Refit `[Header("<name>")]` attribute string without escaping quotation marks. An attacker-influenced OpenAPI description can pass default validation without `--skip-validation` and break out from the parameter-list position by closing the parameter and method syntax, attribute, interface, and namespace. The generated file can remain valid C# while containing a top-level file class with a `[ModuleInitializer]` method, which executes attacker code when the compiled assembly is loaded at application startup, even if the client is never called. Query `AliasAs` and enum/default value sinks are escaped; this flaw is in header-name attribute-string emission. 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: Patch
AI Analysis

Impact

Refitter is a tool that generates C# REST API clients from OpenAPI specifications. Before version 2.1.2 the tool emitted header parameter names directly into a [Header("<name>")] attribute. An attacker who can influence the OpenAPI description can inject characters that close the attribute and the surrounding code, allowing arbitrary C# code to appear in the generated file. The injected code can be placed in a top‑level class with a [ModuleInitializer] method, which executes when the compiled assembly is loaded at application startup, even if the client is never called. This flaw represents a code injection vulnerability (CWE‑94) combined with improper encoding (CWE‑116).

Affected Systems

The affected product is Refitter, a code generator for the Refit library, maintained by christianhelle. All releases older than 2.1.2 are vulnerable. The fix is included in Refitter 2.1.2 and later, and the vulnerability also applies to .NET 8 builds.

Risk and Exploitability

The vulnerability carries a CVSS score of 8.6 and is not listed in the CISA KEV catalog; EPSS data are not available. The attack vector is inferred from the description: an attacker can supply a malicious OpenAPI spec that passes normal validation and is used by Refitter during a normal build, causing the generated assembly to contain attacker code that is executed at startup. The risk of exploitation is high because no user interaction is required beyond providing the specification.

Generated by OpenCVE AI on October 30, 2026 at 23:23 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 official fix.
  • Regenerate and recompile all client libraries that were built with earlier versions of Refitter.
  • Validate or sanitize OpenAPI specifications before feeding them into Refitter to prevent injection.

Generated by OpenCVE AI on October 30, 2026 at 23:23 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, the header parameter name in `parameters[].name` with `in: header` is emitted verbatim into a Refit `[Header("<name>")]` attribute string without escaping quotation marks. An attacker-influenced OpenAPI description can pass default validation without `--skip-validation` and break out from the parameter-list position by closing the parameter and method syntax, attribute, interface, and namespace. The generated file can remain valid C# while containing a top-level file class with a `[ModuleInitializer]` method, which executes attacker code when the compiled assembly is loaded at application startup, even if the client is never called. Query `AliasAs` and enum/default value sinks are escaped; this flaw is in header-name attribute-string emission. 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 header parameter names
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:17:02.231Z

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

Link: CVE-2026-63346

cve-icon Vulnrichment

No data.

cve-icon NVD

Status : Received

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

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

Link: CVE-2026-63346

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')