Refitter flaw enables arbitrary code execution through unescaped OpenAPI content-type values
- Refitter
- code execution
- OpenAPI
- ModuleInitializer

Improper escaping of OpenAPI content-type values identified
Refitter 2.1.2 fixes the vulnerability affecting earlier versions
Injected code executes automatically during assembly load
Refitter has a vulnerability that can lead to arbitrary code execution when it generates a client from an attacker-controlled or attacker-influenced OpenAPI description. The issue affects Refitter versions earlier than 2.1.2.
Refitter writes OpenAPI content-type keys into Refit attribute strings without escaping them. A crafted key can break out of the generated attribute and namespace and add a class with a .NET ModuleInitializer, a method that runs when an assembly loads. The code can therefore execute when an application starts.
The vulnerability was verified with Refitter 2.0.0 and .NET 8. Refitter 2.1.2 is the patched version.




