Refitterに悪意あるコードを実行される脆弱性、修正版2.1.2で対応
Summary
Refitterは、OpenAPIの仕様からC#のREST APIクライアントを生成するツールです。2.1.2より前のバージョンでは、OpenAPIのpathsのキーが生成コードにエスケープされずに出力され、攻撃者が細工したパスによって任意のC#コードを実行される脆弱性(CVE-2026-63345)があります。生成されたアセンブリを読み込むだけで実行されるおそれがあり、CVSS v4.0は8.6です。修正版の2.1.2への更新を進めてください。
AI summary
Produced by SecPulse using an external AI model; it may contain mistakes. Check the original description and references below before acting on it.
Refitterは、OpenAPIの仕様からC#のREST APIクライアントを生成するツールです。2.1.2より前のバージョンでは、OpenAPIのpathsのキーが生成コードにエスケープされずに出力され、攻撃者が細工したパスによって任意のC#コードを実行される脆弱性(CVE-2026-63345)があります。生成されたアセンブリを読み込むだけで実行されるおそれがあり、CVSS v4.0は8.6です。修正版の2.1.2への更新を進めてください。
Affected packages
| Package | Affected → Fixed | |
|---|---|---|
| christianhellerefitter | — | Not listed |
| NuGetRefitter |
< 2.1.2→ 2.1.2 |
2.1.2 |
Original description The description as published by the source.
Summary
Refitter emits each OpenAPI path (the paths-object key) verbatim into a Refit [Get("")]
attribute string, without escaping " or restricting characters. A crafted single-line, /-prefixed
path survives Refitter's default OpenAPI validation yet closes the attribute string and the enclosing
interface + namespace, injects a top-level file class with a [ModuleInitializer] method, and
reopens a namespace + interface so the file stays valid. .NET runs [ModuleInitializer] methods when
the generated assembly is loaded, so the attacker's code executes at application startup. Verified on
Refitter 2.0.0 / .NET 8.
Details
[Get("/p")] Task Dummy(); } }
file class Evil { [System.Runtime.CompilerServices.ModuleInitializer]
internal static void Init(){ /* attacker code */ } }
namespace N2 { public partial interface I2 { [Get("/q")]
Task GetU(string id);
}
}
No --skip-validation is needed (the payload is a valid single-line path). The generated .cs is
compiled into the victim application; the module initializer runs at assembly load. This is distinct
from the value sinks (enum/default), which are escaped; the path sink has no escaping. The
[Header("")] attribute is likewise emitted raw (header parameter names), at minimum a
build-breaking DoS.
PoC
reproduce.sh (+ make_spec.py) attached: generates with default validation, compiles into a console
app, runs it (Main does not touch the client), and shows a marker written at assembl…
Source: CVE.org (CVE Program・cvelistV5) NVD GitHub Advisory
References
- advisory github.com
- package github.com
- web github.com
- web github.com
- web github.com
- web github.com
- web github.com
- web github.com
- web github.com
- web nvd.nist.gov
- web github.com