{"id":"CVE-2026-63345","aliases":["GHSA-3fhm-p725-h3g3"],"url":"https://o3.security/vulnerability/CVE-2026-63345","summary":"Refitter: C# source injection through OpenAPI path keys","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)","published":"2026-10-30T22:13:53.498Z","modified":"2026-11-04T02:31:00.120902621Z","cvss":null,"epss":{"score":0.0035,"percentile":0.29319,"asOf":"2026-11-19"},"cisaKev":null,"exploitsKnown":0,"affectedPackages":[{"ecosystem":"NuGet","name":"Refitter","fixedVersion":"2.1.2"}],"fix":{"url":"https://github.com/christianhelle/refitter/commit/793d2632899c2022511dfc15e30725ef69073973","label":"christianhelle/refitter@793d263"},"references":[{"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"},{"type":"ADVISORY","url":"https://github.com/CVEProject/cvelistV5/tree/main/cves/2026/63xxx/CVE-2026-63345.json"},{"type":"ADVISORY","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":"FIX","url":"https://github.com/christianhelle/refitter/commit/793d2632899c2022511dfc15e30725ef69073973"},{"type":"FIX","url":"https://github.com/christianhelle/refitter/pull/1178"},{"type":"PACKAGE","url":"https://github.com/christianhelle/refitter"}],"provenance":{"sources":["OSV.dev","FIRST.org (EPSS)"],"lastVerified":"2026-11-04T02:31:00.120902621Z"}}