{"id":"GHSA-3fhm-p725-h3g3","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(\"\u003cpath\u003e\")]`\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\u003cstring\u003e 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\u003cstring\u003e 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(\"\u003cname\u003e\")]` 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)","aliases":["CVE-2026-63345"],"modified":"2026-11-20T00:15:05.538354665Z","published":"2026-11-20T00:06:04Z","database_specific":{"github_reviewed_at":"2026-11-20T00:06:04Z","nvd_published_at":"2026-10-30T23:17:13Z","cwe_ids":["CWE-1116","CWE-94"],"severity":"CRITICAL","github_reviewed":true},"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"}],"affected":[{"package":{"name":"Refitter","ecosystem":"NuGet","purl":"pkg:nuget/Refitter"},"ranges":[{"type":"ECOSYSTEM","events":[{"introduced":"0"},{"fixed":"2.1.2"}]}],"versions":["0.1.2-alpha","0.1.3-alpha","0.1.4-alpha","0.1.5-alpha","0.2.0-alpha","0.2.1-alpha","0.2.2-alpha","0.2.3-alpha","0.2.4-alpha","0.3.0","0.3.1","0.3.16","0.3.17","0.3.2","0.3.3","0.3.4","0.4.0","0.4.1","0.4.2","0.5.0","0.5.1","0.5.2","0.5.25","0.5.26","0.5.27","0.5.28","0.5.29","0.5.3","0.5.30","0.6.0","0.6.1","0.6.2","0.6.3","0.7.0","0.7.0.20-preview","0.7.0.21-preview","0.7.0.22-preview","0.7.0.23-preview","0.7.0.26-preview","0.7.0.27-preview","0.7.0.28-preview","0.7.1","0.7.1.29-preview","0.7.1.30-preview","0.7.1.31-preview","0.7.2","0.7.2.32-preview","0.7.3","0.7.3.33-preview","0.7.3.34-preview","0.7.3.35-preview","0.7.3.36-preview","0.7.3.37-preview","0.7.4","0.7.5","0.8.0","0.8.1","0.8.2","0.8.3","0.8.4","0.8.5","0.8.6","0.8.6.38-preview","0.8.6.39-preview","0.8.7","0.8.7.40-preview","0.8.7.41-preview","0.9.0","0.9.1","0.9.2","0.9.3.42-preview","0.9.4","0.9.4.43-preview","0.9.5","0.9.6","0.9.7","0.9.8","0.9.9","0.9.9.44-preview","1.0.0","1.0.1","1.0.2","1.1.0.45-preview","1.1.1","1.1.2","1.1.3","1.2.0","1.3.0","1.3.1","1.3.2","1.4.0","1.4.1","1.5.0","1.5.1","1.5.2","1.5.3","1.5.4","1.5.5","1.5.6","1.6.0","1.6.1","1.6.2","1.6.3","1.6.4","1.6.5","1.7.0","1.7.1","1.7.2","1.7.3","2.0.0","2.1.0","2.1.1"],"database_specific":{"source":"https://github.com/github/advisory-database/blob/main/advisories/github-reviewed/2026/11/GHSA-3fhm-p725-h3g3/GHSA-3fhm-p725-h3g3.json"}}],"schema_version":"1.9.2","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"}]}