CVE-2026-63345: Refitter Refitter Allows Arbitrary Code Execution Vulnerability

CRITICAL
Advisory Identifier: GHSA-3fhm-p725-h3g3
CWE-94 CWE-1116
Published
Advisory Summary

CVE-2026-63345 is a CRITICAL refitter allows arbitrary code execution vulnerability (CWE-94: Improper Control of Generation of Code ('Code Injection')) affecting Refitter libraries in the NuGet ecosystem. The issue involves refitter allows arbitrary code execution through unescaped openapi paths. Remediation is available by upgrading affected packages to version 2.1.2.

CVE-2026-63345 at a Glance

CVE Identifier CVE-2026-63345
GHSA Identifier GHSA-3fhm-p725-h3g3
Severity CRITICAL
CVSS v3.1 Base Score N/A
CWE Classification CWE-94: Improper Control of Generation of Code ('Code Injection')
Affected Product Refitter
Package Ecosystem NuGet
Published Date
Last Updated

How to Fix CVE-2026-63345

To remediate this vulnerability, upgrade all affected Refitter dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

Refitter fixed: 2.1.2
Upgrade Refitter to 2.1.2
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for Refitter

How to Check if You Are Affected

To determine whether your application is affected by CVE-2026-63345, inspect your project dependencies for Refitter:

inspect dependencies for Refitter

Analyze the terminal output to locate any version of Refitter in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 2.1.2), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-94: Improper Control of Generation of Code ('Code Injection'), where the product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment. In Refitter, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

### Summary Refitter emits each OpenAPI path (the paths-object key) verbatim into a Refit `[Get("<path>")]` attribute string, without escaping `"` or restricting characters. A crafted single-line, /-prefixed path survives Refitter's default OpenAPI validation yet closes the attribute string and the enclosing interface + namespace, injects a top-level `file class` with a `[ModuleInitializer]` method, and reopens a namespace + interface so the file stays valid. .NET runs `[ModuleInitializer]` methods when the generated assembly is loaded, so the attacker's code executes at application startup. Verified on Refitter 2.0.0 / .NET 8. ### Details ``` [Get("/p")] Task<string> Dummy(); } } file class Evil { [System.Runtime.CompilerServices.ModuleInitializer] internal static void Init(){ /* attacker code */ } } namespace N2 { public partial interface I2 { [Get("/q")] Task<string> GetU(string id); } } ``` No `--skip-validation` is needed (the payload is a valid single-line path). The generated `.cs` is compiled into the victim application; the module initializer runs at assembly load. This is distinct from the value sinks (enum/default), which are escaped; the path sink has no escaping. The `[Header("<name>")]` attribute is likewise emitted raw (header parameter names), at minimum a build-breaking DoS. ### PoC `reproduce.sh` (+ `make_spec.py`) attached: generates with default validation, compiles into a console app, runs it (Main does not touch the client), and shows a marker written at assembly load. Verified on 2.0.0. ### Impact Code execution at assembly load (process startup) in any application that compiles a Refitter client generated from an attacker-controlled or attacker-influenced OpenAPI description. ### Suggested fix Escape the route template before emitting it into `[Get("…")]` (escape `"`, `\`, reject newlines) and validate that paths contain only legal URI-template characters. Apply the same encoding to `[Header(…)]`, `[Post/Put/Delete(…)]`, and every attribute that embeds a spec-derived string. [maintainer-report.txt](https://github.com/user-attachments/files/29395228/maintainer-report.txt) [make_spec.py](https://github.com/user-attachments/files/29395229/make_spec.py) [reproduce.sh](https://github.com/user-attachments/files/29395230/reproduce.sh)

CVE-2026-63345 Affected Refitter Versions

1 component(s)
Fixed Versions:
2.1.2
Product / Package Ecosystem Affected Versions Fixed Version
Refitter
NuGet
< 2.1.2
2.1.2

References

Frequently Asked Questions

What is CVE-2026-63345?
CVE-2026-63345 is a security vulnerability in Refitter involving Refitter allows arbitrary code execution through unescaped OpenAPI paths under CWE-94: Improper Control of Generation of Code ('Code Injection').
Which Refitter versions are affected?
Affected versions include releases prior to 2.1.2 across affected packages: Refitter.
What version fixes CVE-2026-63345?
Upgrading to 2.1.2 (or the latest patched release for your respective branch) resolves the vulnerability.
Is Refitter affected?
Yes, Refitter is affected in releases prior to 2.1.2. Upgrade your dependency to 2.1.2 or later.
What CWE is associated with CVE-2026-63345?
CVE-2026-63345 is classified under CWE-94: Improper Control of Generation of Code ('Code Injection') (The product constructs all or part of a code segment using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the syntax or behavior of the intended code segment.).
How can I check NuGet dependencies for CVE-2026-63345?
Run the dependency tree command: 'inspect dependencies for Refitter'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-3fhm-p725-h3g3",
  "modified" : "2026-11-20T00:06:04Z",
  "published" : "2026-11-20T00:06:04Z",
  "aliases" : [ "CVE-2026-63345" ],
  "summary" : "Refitter allows arbitrary code execution through unescaped OpenAPI paths",
  "details" : "### Summary\n\nRefitter emits each OpenAPI path (the paths-object key) verbatim into a Refit `[Get(\"<path>\")]`\nattribute string, without escaping `\"` or restricting characters. A crafted single-line, /-prefixed\npath survives Refitter's default OpenAPI validation yet closes the attribute string and the enclosing\ninterface + namespace, injects a top-level `file class` with a `[ModuleInitializer]` method, and\nreopens a namespace + interface so the file stays valid. .NET runs `[ModuleInitializer]` methods when\nthe generated assembly is loaded, so the attacker's code executes at application startup. Verified on\nRefitter 2.0.0 / .NET 8.\n\n### Details\n\n```\n[Get(\"/p\")] Task<string> Dummy(); } }\nfile class Evil { [System.Runtime.CompilerServices.ModuleInitializer]\n  internal static void Init(){ /* attacker code */ } }\nnamespace N2 { public partial interface I2 { [Get(\"/q\")]\n        Task<string> GetU(string id);\n    }\n}\n```\n\nNo `--skip-validation` is needed (the payload is a valid single-line path). The generated `.cs` is\ncompiled into the victim application; the module initializer runs at assembly load. This is distinct\nfrom the value sinks (enum/default), which are escaped; the path sink has no escaping. The\n`[Header(\"<name>\")]` attribute is likewise emitted raw (header parameter names), at minimum a\nbuild-breaking DoS.\n\n### PoC\n\n`reproduce.sh` (+ `make_spec.py`) attached: generates with default validation, compiles into a console\napp, runs it (Main does not touch the client), and shows a marker written at assembly load. Verified\non 2.0.0.\n\n### Impact\n\nCode execution at assembly load (process startup) in any application that compiles a Refitter client\ngenerated from an attacker-controlled or attacker-influenced OpenAPI description.\n\n### Suggested fix\n\nEscape the route template before emitting it into `[Get(\"…\")]` (escape `\"`, `\\`, reject newlines) and\nvalidate that paths contain only legal URI-template characters. Apply the same encoding to\n`[Header(…)]`, `[Post/Put/Delete(…)]`, and every attribute that embeds a spec-derived string.\n[maintainer-report.txt](https://github.com/user-attachments/files/29395228/maintainer-report.txt)\n[make_spec.py](https://github.com/user-attachments/files/29395229/make_spec.py)\n[reproduce.sh](https://github.com/user-attachments/files/29395230/reproduce.sh)",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "NuGet",
      "name" : "Refitter"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "2.1.2"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/christianhelle/refitter/security/advisories/GHSA-3fhm-p725-h3g3"
  }, {
    "type" : "ADVISORY",
    "url" : "https://nvd.nist.gov/vuln/detail/CVE-2026-63345"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/christianhelle/refitter/pull/1178"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/christianhelle/refitter/commit/793d2632899c2022511dfc15e30725ef69073973"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/christianhelle/refitter"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/christianhelle/refitter/releases/tag/2.1.2"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/user-attachments/files/29395228/maintainer-report.txt"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/user-attachments/files/29395229/make_spec.py"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/user-attachments/files/29395230/reproduce.sh"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-1116", "CWE-94" ],
    "severity" : "CRITICAL",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-11-20T00:06:04Z",
    "nvd_published_at" : "2026-10-30T23:17:13Z"
  }
}