{"id":"CVE-2026-63346","aliases":["CVE-2026-63346","GHSA-58x9-vjvp-6mx8"],"related":[],"kind":"vulnerability","state":"published","title":"Refitter: C# source injection through OpenAPI header parameter names","summary":"Refitter is a tool for generating a C# REST API client using the Refit library. Prior to 2.1.2, the header parameter name in `parameters[].name` with `in: header` is emitted verbatim into a Refit `[Header(\"<name>\")]` attribute string without escaping quotation marks. An attacker-influenced OpenAPI description can pass default validation without `--skip-validation` and break out from the parameter-list position by closing the parameter and method syntax, attribute, interface, and namespace. The generated file can remain valid C# while containing a top-level file class with a `[ModuleInitializer]` method, which executes attacker code when the compiled assembly is loaded at application startup, even if the client is never called. Query `AliasAs` and enum/default value sinks are escaped; this flaw is in header-name attribute-string emission. The behavior was verified with Refitter 2.0.0 and .NET 8. This issue is fixed in version 2.1.2.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"Refitter is a tool for generating a C# REST API client using the Refit library. Prior to 2.1.2, the header parameter name in `parameters[].name` with `in: header` is emitted verbatim into a Refit `[Header(\"<name>\")]` attribute string without escaping quotation marks. An attacker-influenced OpenAPI description can pass default validation without `--skip-validation` and break out from the parameter-list position by closing the parameter and method syntax, attribute, interface, and namespace. The generated file can remain valid C# while containing a top-level file class with a `[ModuleInitializer]` method, which executes attacker code when the compiled assembly is loaded at application startup, even if the client is never called. Query `AliasAs` and enum/default value sinks are escaped; this flaw is in header-name attribute-string emission. The behavior was verified with Refitter 2.0.0 and .NET 8. This issue is fixed in version 2.1.2.","source":"cvelist"},{"lang":"en","text":"### Summary\n\nRefitter emits the spec's header parameter name (parameters[].name with in: header) verbatim into a Refit `[Header(\"<name>\")]` attribute string without escaping\n`\"`. A crafted value survives Refitter's default OpenAPI validation, breaks out of the attribute and\nthe enclosing interface + namespace, injects a top-level `file class` with a `[ModuleInitializer]`\nmethod, and reopens so the file stays valid. .NET runs `[ModuleInitializer]` methods at assembly\nload, so the attacker's code executes at application startup. Verified on Refitter 2.0.0 / .NET 8.\n\nNotable: the breakout starts from a PARAMETER-LIST position (it closes the params and method first).\nThe malicious input is a header parameter name. No `--skip-validation` is required. The query\n`AliasAs` and value sinks (enum, default) are escaped; the gap is in the attribute-string emission.\n\n### PoC\n\n`reproduce.sh` (+ `make_spec.py`) attached: generates with default validation, compiles into a\nconsole app, runs it (Main does not touch the client), and shows a marker written at assembly load.\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. Estimated Critical, e.g.\n`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` (the CNA sets the final score).\n\n### Suggested fix\n\nEscape every spec-derived string before emitting it into a Refit attribute (escape `\"`, `\\`,\nreject newlines) and validate characters. We recommend auditing all attribute emissions that embed\nspec-derived values, using one shared encoder.\n[maintainer-report.txt](https://github.com/user-attachments/files/29395048/maintainer-report.txt)\n[make_spec.py](https://github.com/user-attachments/files/29395050/make_spec.py)\n[reproduce.sh](https://github.com/user-attachments/files/29395051/reproduce.sh)","format":"markdown","source":"ghsa"}],"published":"2026-10-30T22:17:02.231Z","modified":"2026-11-20T00:15:05.562Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:4.0","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","score":8.6,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:4.0","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","score":8.6,"rating":"HIGH"},{"scorer":"GitHub","scheme":"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","rating":"CRITICAL"}],"cwes":["CWE-94","CWE-116"],"affected":[{"ranges":[{"version":"< 2.1.2","status":"affected"}],"vendor":"christianhelle","product":"refitter","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"2.1.2"}],"ecosystem":"NuGet","package":"Refitter","purl":"pkg:nuget/Refitter","source":"ghsa"}],"references":[{"url":"https://github.com/christianhelle/refitter/security/advisories/GHSA-58x9-vjvp-6mx8","tags":["exploit","web","x-refsource-confirm"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/christianhelle/refitter/pull/1178","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/christianhelle/refitter/commit/63a19b03699a9c267d6fab5f758ec26484db83a1","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/christianhelle/refitter/releases/tag/2.1.2","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/user-attachments/files/29395048/maintainer-report.txt","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/user-attachments/files/29395050/make_spec.py","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://github.com/user-attachments/files/29395051/reproduce.sh","tags":["web","x-refsource-misc"],"sources":["cvelist","ghsa","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-63346","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/christianhelle/refitter","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"total","date":"2026-11-02T14:46:50.420Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-63346","url":"https://www.cve.org/CVERecord?id=CVE-2026-63346","licence":"CVE Terms of Use","modified":"2026-11-02T14:47:20.841Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-58x9-vjvp-6mx8","url":"https://github.com/advisories/GHSA-58x9-vjvp-6mx8","licence":"CC-BY-4.0","modified":"2026-11-20T00:15:05.562Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-63346","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-63346","licence":"Public domain","modified":"2026-11-02T19:35:33.347Z"}],"updatedAt":"2026-11-25T22:59:48.043Z","epss":{"score":0.00568,"percentile":0.48434,"date":"2026-12-01T12:00:22.000Z"}}