Refitterに任意のローカルファイルを読まれる脆弱性、SSRF
Summary
Refitter 2.1.1より前の版には、攻撃者が用意したOpenAPI定義の参照を無制限に解決してしまう脆弱性があります。外部URLへのリクエストや、ローカルファイルの内容が生成コードに取り込まれ、情報が漏えいするおそれがあります。修正版の2.1.1で修正されているため、Refitterを2.1.1以降に更新してください。
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.1より前の版には、攻撃者が用意したOpenAPI定義の参照を無制限に解決してしまう脆弱性があります。外部URLへのリクエストや、ローカルファイルの内容が生成コードに取り込まれ、情報が漏えいするおそれがあります。修正版の2.1.1で修正されているため、Refitterを2.1.1以降に更新してください。
Affected packages
| Package | Affected → Fixed | |
|---|---|---|
| christianhellerefitter | — | Not listed |
| NuGetRefitter |
< 2.1.1→ 2.1.1 |
2.1.1 |
Original description The description as published by the source.
Summary
Refitter (the refitter dotnet tool, built on NJsonSchema for $ref resolution) fetches remote
http(s) URLs and reads local files (including absolute paths and ../ traversal outside the input
directory), inlining the referenced schema into the generated Refit interface/contracts. Running
refitter --output Out.cs on a spec whose $ref points at an attacker/internal URL or an
arbitrary local file yields SSRF, remote file inclusion, and local file inclusion. Verified on
Refitter 2.0.0.
Details
$ref: http://attacker-or-internal/evil.json#/...-> build host fetches (SSRF) and inlines the
remote schema (RFI); confirmed propertyREMOTE_REFIT_PROP.$ref: /abs/path.json#/...or../../secret.json#/...-> out-of-tree local file read + inlined
(LFI); confirmed propertyREFIT_LFI_MARKER. Both absolute and relative traversal work.
No RCE: Refitter emits Refit interfaces with no baseUrl string literal (Refit sets the base address at
runtime), enum values use C# verbatim-string doubling, and string defaults are escaped. The chain
stops at SSRF + RFI + LFI.
The $ref resolution is performed by Refitter's NJsonSchema dependency, which Refitter ships and
invokes with these unsafe defaults.
PoC
reproduce.sh (+ make_spec.py, listener.py) attached: installs the .NET SDK + Refitter if needed,
confirms LFI (out-of-tree read), SSRF (listener hit during generation), and RFI (remote schema
inlined). Verified on 2.0.0.
Impact
Build-time…
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 github.com
- web github.com
- web github.com
- web github.com
- web github.com
- web nvd.nist.gov
- web github.com