CRITICAL · CVSS 4.0 EPSS 0.6% · 48th percentile CWE-1116CWE-94

CVE-2026-63345: Refitter allows arbitrary code execution through unescaped OpenAPI paths

Published 2026-11-20 · Updated 2026-11-20 · Also known as GHSA-3fhm-p725-h3g3

Summary

Refitter allows arbitrary code execution because it emits unescaped OpenAPI paths verbatim into Refit attributes, enabling syntax breakout and injected module initializers. Engineering teams using NuGet package Refitter should update immediately.

Who is affected

Deployments that compile Refitter-generated C# code from attacker-controlled or attacker-influenced OpenAPI descriptions are vulnerable. An attacker can craft a specific single-line OpenAPI path that closes code blocks, injects a top-level file class with a [ModuleInitializer] method, and executes arbitrary code at application startup when the assembly loads.

Exploitability

The vulnerability carries a CVSS 4.0 base score of CRITICAL with network attack vector, low complexity, no privileges required, and no user interaction needed, resulting in high impacts to confidentiality, integrity, and availability. The EPSS score is 0.004 (percentile 0.293) and it is not listed in the CISA Known Exploited Vulnerabilities catalog.

Remediation

How to check your project

Automated analysis of the published advisory data, generated 2026-11-20. Not human-reviewed; verify against the official advisory. How this works.

Affected packages

EcosystemPackageAffected versionsFixed inUpgrade
NuGet Refitter >= 0, < 2.1.2 2.1.2 dotnet add package Refitter --version 2.1.2

CVSS 4.0 vector

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

Attack vectorNetwork
Attack complexityLow
Attack requirementsNone
Privileges requiredNone
User interactionNone
Confidentiality (vulnerable system)High
Integrity (vulnerable system)High
Availability (vulnerable system)High
Confidentiality (subsequent systems)None
Integrity (subsequent systems)None
Availability (subsequent systems)None

Base score is not computed for CVSS 4.0 vectors; severity is taken from the advisory.

FAQ

What causes the vulnerability in Refitter?

Refitter emits OpenAPI paths and header parameter names directly into C# attributes without escaping double quotes or restricting characters, allowing syntax breakout.

When does the injected attacker code execute?

The injected code executes immediately at application startup when .NET runs [ModuleInitializer] methods upon loading the generated assembly.

Is a special flag required to bypass validation for the exploit?

No, a crafted single-line path successfully survives Refitter's default OpenAPI validation.

Original advisory description
### 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)

References

Source records: GHSA-3fhm-p725-h3g3 (OSV.dev) · EPSS by FIRST, 2026-11-22.