CVE-2026-63345

Refitter: C# source injection through OpenAPI path keys

Published Oct 30, 2026 CVSS 4.0 · 8.6 High EPSS < 1% KEV · Not listed
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.

Analysis

AI-generated

Technical 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.

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

Source ID Title
Github GHSA Github GHSA GHSA-3fhm-p725-h3g3 Refitter allows arbitrary code execution through unescaped OpenAPI paths
History
Type Values Removed Values Added
First Time appeared Christianhelle
Christianhelle refitter
Vendors & Products Christianhelle
Christianhelle refitter
Type Values Removed Values Added
Metrics ssvc

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

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

Weaknesses
  • CWE-1116

    Inaccurate Source Code Comments

  • CWE-94

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

Sources

Status
PUBLISHED
Assigner
GitHub_M
Published
Updated
Nov 2, 2026, 5:58 PM
Reserved
Jul 16, 2026, 2:14 PM
Status
Deferred
Published
Oct 30, 2026, 11:17 PM
Modified
Nov 2, 2026, 7:35 PM