Summary
Refitter versions before 2.1.2 do not escape OpenAPI header parameter names when generating code, which allows injected code to run when the assembly loads. The source rates it critical (CVSS 4.0: 9.3).
What happened
Refitter writes the name of a spec header parameter (parameters[].name with in: header) verbatim into a Refit [Header("...")] attribute string without escaping double quotes. According to the source, a crafted value passes Refitter's default OpenAPI validation, breaks out of the attribute and its enclosing block, and introduces additional code into the generated file, including a method marked with [ModuleInitializer]. Disabling validation is not required. The other emission points mentioned (query AliasAs, enum and default values) are escaped; the gap is in the attribute-string emission. The associated CWEs are CWE-94 and CWE-116.
Why it matters
According to the source, .NET runs [ModuleInitializer] methods when the assembly loads, so the injected code would execute at startup of an application that compiles a Refitter-generated client from an attacker-controlled or attacker-influenced OpenAPI description. The score is CVSS 4.0 9.3 (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), with critical severity per GHSA. CISA's KEV catalog does not list active exploitation; the source states it was verified on Refitter 2.0.0 with .NET 8.
Affected products and versions
Refitter (NuGet): versions before 2.1.2 (< 2.1.2). Fixed version: 2.1.2.
| Product | Versions | Fixed in |
|---|---|---|
| Refitter | < 2.1.2 | 2.1.2 |
Action recommended by the source
The source indicates the fix is in Refitter version 2.1.2. The project's maintainers suggest escaping every spec-derived string before emitting it into a Refit attribute (escape double quotes and backslashes, reject newlines), validating characters, and auditing all attribute emissions with a shared encoder.
Fixed in: 2.1.2
Sources and references
- https://github.com/advisories/GHSA-58x9-vjvp-6mx8 — GHSA
- https://github.com/christianhelle/refitter/security/advisories/GHSA-58x9-vjvp-6mx8 — GHSA
- https://nvd.nist.gov/vuln/detail/CVE-2026-63346 — GHSA
- https://github.com/christianhelle/refitter/pull/1178 — GHSA
- https://github.com/christianhelle/refitter/commit/63a19b03699a9c267d6fab5f758ec26484db83a1 — GHSA
- https://github.com/christianhelle/refitter/releases/tag/2.1.2 — GHSA
- https://github.com/user-attachments/files/29395048/maintainer-report.txt — GHSA
- https://github.com/user-attachments/files/29395050/make_spec.py — GHSA
- https://github.com/user-attachments/files/29395051/reproduce.sh — GHSA
Weaknesses (CWE): CWE-94, CWE-116
Relevant change history
Published
Advisory published.