CVE-2026-63346: Refitter allows code execution through unescaped OpenAPI header parameter names
Critical
- OSV id
- GHSA-58x9-vjvp-6mx8
- Also known as
- CVE-2026-63346
- Published
- Last modified
Affected packages
| Package | Affected versions | Fixed in |
|---|---|---|
| Refitter NuGet |
< 2.1.2 | 2.1.2 |
How to fix it
Upgrade Refitter to 2.1.2 or later.
dotnet add package Refitter --version 2.1.2
dotnet restore --force-evaluate
- If it is an indirect (transitive) dependency, add a direct PackageReference to the fixed version, or upgrade the package that depends on it; `dotnet list package --include-transitive` shows which one.
- Check the changelog for breaking changes (especially across major versions), update the lockfile with the package manager, and run your tests.
Not sure whether your project uses an affected version? Check your lockfile below for free.
Details
Summary
Refitter emits the spec's header parameter name (parameters[].name with in: header) verbatim into a Refit [Header("<name>")] 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.
Notable: the breakout starts from a PARAMETER-LIST position (it closes the params and method first).
The malicious input is a header parameter name. No --skip-validation is required. The query
AliasAs and value sinks (enum, default) are escaped; the gap is in the attribute-string emission.
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 encoder.
maintainer-report.txt
make_spec.py
reproduce.sh
References
- GHSA-58x9-vjvp-6mx8 on OSV.dev
- Web: https://github.com/christianhelle/refitter/security/advisories/GHSA-58x9-vjvp-6mx8
- Advisory: https://nvd.nist.gov/vuln/detail/CVE-2026-63346
- Web: https://github.com/christianhelle/refitter/pull/1178
- Web: https://github.com/christianhelle/refitter/commit/63a19b03699a9c267d6fab5f758ec26484db83a1
- Package: https://github.com/christianhelle/refitter
- Web: https://github.com/christianhelle/refitter/releases/tag/2.1.2
- Web: https://github.com/user-attachments/files/29395048/maintainer-report.txt
- Web: https://github.com/user-attachments/files/29395050/make_spec.py
- Web: https://github.com/user-attachments/files/29395051/reproduce.sh
Am I affected?
Upload or paste your lockfile. We check every package version in it against OSV.dev, this advisory included, and email you the vulnerable ones with the version that fixes them. Free, and no account needed.
About this data
Source: GitHub Advisory Database via OSV.dev (CC-BY 4.0). Severity comes from the advisory's own rating when it has one, else from its CVSS score.