Refitterに任意のC#コードを実行される脆弱性、修正版は2.1.2
Summary
Refitterの2.1.2より前のバージョンには、OpenAPI記述のcontent-typeキーをエスケープせずに生成コードへ書き出す脆弱性(CVE-2026-63344)があります。細工したOpenAPI記述を使うと、生成されたアセンブリの読み込み時に攻撃者のコードが実行されるおそれがあり、CVSS v4.0のスコアは8.6です。修正版の2.1.2で対処できるため、Refitterを使っている場合は早めに更新してください。
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の2.1.2より前のバージョンには、OpenAPI記述のcontent-typeキーをエスケープせずに生成コードへ書き出す脆弱性(CVE-2026-63344)があります。細工したOpenAPI記述を使うと、生成されたアセンブリの読み込み時に攻撃者のコードが実行されるおそれがあり、CVSS v4.0のスコアは8.6です。修正版の2.1.2で対処できるため、Refitterを使っている場合は早めに更新してください。
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 the spec's content-type key (content map key in requestBody/responses) verbatim into a Refit [Headers("Accept: ", "Content-Type: ")] attribute string without escaping
". A crafted value survives Refitter's default OpenAPI validation, breaks out of the attribute and
the enclosing interface + namespace, injects a top-level file class with a [ModuleInitializer]
method, and reopens so the file stays valid. .NET runs [ModuleInitializer] methods at assembly
load, so the attacker's code executes at application startup. Verified on Refitter 2.0.0 / .NET 8.
The malicious input is a content-type KEY such as: content: { 'application/': {schema} }.
No --skip-validation is required.
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 assembly load.
Impact
Code execution at assembly load (process startup) in any application that compiles a Refitter client
generated from an attacker-controlled or attacker-influenced OpenAPI description. Estimated Critical, e.g.
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 (the CNA sets the final score).
Suggested fix
Escape every spec-derived string before emitting it into a Refit attribute (escape ", \,
reject newlines) and validate characters. We recommend auditing all attribute emissions that embed
spec-derived values, using one shared encode…
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