Descrizione
Refitter is a tool for generating a C# REST API client using the Refit library. Prior to 2.1.2, content-type keys in the content maps of `requestBody/responses` are emitted verbatim into a Refit `[Headers("Accept: <ct>", "Content-Type: <ct>")]` attribute string without escaping quotation marks. A crafted content-type key in an attacker-influenced OpenAPI description survives default validation without `--skip-validation`, breaks out of the attribute string and enclosing interface and namespace, and can introduce a top-level file class while leaving valid generated C#. A `[ModuleInitializer]` method in that class executes attacker code when the generated assembly is loaded at application startup, without requiring a call to the client. The behavior was verified with Refitter 2.0.0 and .NET 8. This issue is fixed in version 2.1.2.
Come correggere
Priorità: Media — correggere nel prossimo ciclo di patch. Motivazione: CVSS 8.6, EPSS 0.4% (percentile 29).
Versioni da aggiornare
Il record non riporta ancora i prodotti e le versioni corrette (analisi NVD in corso). Consultare l'advisory del vendor nei riferimenti.
Mitigazioni temporanee
Da applicare solo se non è possibile aggiornare subito:
- Bloccare l'accesso esterno al componente, applicare regole WAF per payload di code/template injection e monitorare l'esecuzione di processi figli.
Verifica
- Individuare tutti gli asset con il prodotto interessato (inventario, scanner di vulnerabilità, CMDB).
- Confrontare la versione installata con quelle indicate sopra.
- Applicare l'aggiornamento in un ambiente di test, poi in produzione; riavviare i servizi se richiesto.
- Ripetere la scansione per confermare la correzione.
Riferimenti
- Riferimentohttps://github.com/christianhelle/refitter/commit/ab4d8e439d6f0ee82ad49ee15323978d70fe5a67
- Riferimentohttps://github.com/christianhelle/refitter/pull/1178
- Riferimentohttps://github.com/christianhelle/refitter/releases/tag/2.1.2
- Riferimentohttps://github.com/christianhelle/refitter/security/advisories/GHSA-p32v-8v8j-j534
- Riferimentohttps://github.com/user-attachments/files/29394848/reproduce.sh
- Riferimentohttps://github.com/user-attachments/files/29394851/maintainer-report.txt
- Riferimentohttps://github.com/user-attachments/files/29394853/make_spec.py
- Riferimentohttps://github.com/christianhelle/refitter/security/advisories/GHSA-p32v-8v8j-j534