Description
Refitter is a tool for generating a C# REST API client using the Refit library. Prior to 2.1.2, OpenAPI `paths`-object keys are emitted verbatim into Refit route attributes such as `[Get("<path>")]` without escaping quotation marks or restricting characters. An attacker-influenced single-line, slash-prefixed path survives default validation without `--skip-validation` and can close the attribute string, interface, and namespace while introducing a top-level file class and reopening the generated structure to keep valid C#. A `[ModuleInitializer]` method executes attacker code when an application compiles and loads the generated assembly at startup, even without calling the generated client. The enum and default value sinks are escaped and are not the vulnerable path-emission sink. The behavior was verified on Refitter 2.0.0 with .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: Source code injection capable of executing arbitrary code during application startup
Action: Immediate Patch
AI Analysis

Impact

The vulnerability arises from Refitter's practice of inserting OpenAPI 'paths' keys directly into C# route attributes without escaping quotation marks or restricting characters, allowing an attacker-controlled path to terminate the attribute string, inject a new top-level class, and close the generated code structure; when the resulting assembly contains a [ModuleInitializer] method, that code executes automatically upon loading, enabling arbitrary code execution during application startup, which corresponds to CWE-1116 (Code Injection) and CWE-94 (Improper Validation of Input Leading to Code Injection).

Affected Systems

The affected product is Refitter, a C# client code generator that embeds OpenAPI 'paths' into Refit route attributes; all non-2.1.2 releases, including version 2.0.0, are impacted, and the developer Christianhelle issued the fix in the 2.1.2 release, meaning any project that compiles and loads a Refitter-generated assembly before that update is vulnerable.

Risk and Exploitability

The CVSS score of 8.6 indicates high severity; without an EPSS score we cannot quantify exploitation prevalence, but it is not listed in CISA's KEV catalog; the attack requires control over the OpenAPI spec processed by Refitter, and when a malicious specification is used to generate code that is compiled and loaded, the embedded ModuleInitializer automatically executes at startup; such a scenario can arise in develop or CI pipelines that process untrusted specifications or in production if a repository accepts attacker-supplied specs; the vulnerability therefore poses a remote code execution risk at application launch.

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

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade Refitter to version 2.1.2 or later, which eliminates the unescaped path handling that permits injection.
  • Validate OpenAPI 'path' keys against an allowlist before passing them to Refitter; reject or sanitize any keys containing quotation marks or other special characters to prevent injection.
  • If upgrading is not immediately possible, review the generated assembly for [ModuleInitializer] attributes and either remove them or disable automatic module initialization in the target project.

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

Tracking

Sign in to view the affected projects.

Advisories

No advisories yet.

History

Fri, 30 Oct 2026 22:15: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, OpenAPI `paths`-object keys are emitted verbatim into Refit route attributes such as `[Get("<path>")]` without escaping quotation marks or restricting characters. An attacker-influenced single-line, slash-prefixed path survives default validation without `--skip-validation` and can close the attribute string, interface, and namespace while introducing a top-level file class and reopening the generated structure to keep valid C#. A `[ModuleInitializer]` method executes attacker code when an application compiles and loads the generated assembly at startup, even without calling the generated client. The enum and default value sinks are escaped and are not the vulnerable path-emission sink. The behavior was verified on Refitter 2.0.0 with .NET 8. This issue is fixed in version 2.1.2.
Title Refitter: C# source injection through OpenAPI path keys
Weaknesses CWE-1116
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:13:53.498Z

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

Link: CVE-2026-63345

cve-icon Vulnrichment

No data.

cve-icon NVD

Status : Received

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

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

Link: CVE-2026-63345

cve-icon Redhat

No data.

cve-icon OpenCVE Enrichment

Updated: 2026-10-31T00:00:27Z

Weaknesses
  • CWE-1116

    Inaccurate Source Code Comments

  • CWE-94

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