On this page (8 sections)

Refitter, a tool that generates C# REST API clients for the Refit library from OpenAPI descriptions, has a code injection flaw tracked as CVE-2026-63344. In versions before 2.1.2, a crafted content-type key in an OpenAPI file is written into the generated C# without escaping, which lets an attacker add their own code to the output. That code can run as soon as the compiled application starts.

If your team generates clients from OpenAPI specs that you do not fully control, such as a partner's API, a public registry or a spec fetched during a build, you should check your Refitter version now. The fix is in 2.1.2.

What happened

The GitHub advisory describes a flaw in how Refitter builds the attribute that sets HTTP headers on generated client methods. Refitter takes the content-type keys from the requestBody and responses content maps of an OpenAPI document and places them directly into a Refit Headers attribute string. Quotation marks in those keys are not escaped.

A specially crafted key can therefore close the string, then close the enclosing interface and namespace, and add a new top-level class to the generated file. The file is then reopened so that it still compiles as valid C#. The advisory states that the crafted value passes Refitter's default OpenAPI validation, so the --skip-validation option is not needed to trigger the issue.

The advisory reports the behavior was verified with Refitter 2.0.0 on .NET 8. The maintainer fix is in release 2.1.2, with the change tracked in pull request 1178.

Why this runs at startup

The injected class can contain a method marked with the .NET ModuleInitializer attribute. The runtime executes such methods when the assembly is loaded, before the application calls anything in it. According to the advisory, the injected code runs at application startup even if the program never touches the generated client.

This is a classic output-encoding problem: data from an input file is treated as code because it was written into source text without escaping. The risk is not in the running API client but in the build chain. Whoever influences the OpenAPI file can influence code that ends up inside your compiled application.

How severe is it, and what do the scores mean

Sources differ on the score, so it is worth being precise. The CVE record lists CVSS 8.6 with a high rating. The GitHub advisory page shows a Critical rating with an overall CVSS v4 score of 9.3, with network attack vector, low complexity, no privileges and no user interaction. The advisory text itself calls the critical rating an estimate and says the CNA sets the final score.

CVSS score in the CVE record (high)
8.6
CVSS v4 score shown on the GitHub advisory page (Critical)
9.3
First fixed Refitter version
2.1.2

Whichever number you use, the practical point is the same: code execution is possible in any application that compiles a Refitter client generated from an attacker-controlled or attacker-influenced OpenAPI description. If your specs come only from your own repository and your own reviewed changes, your real exposure is much lower.

Who is realistically exposed

  • Teams that generate clients from third-party or partner OpenAPI files, especially when the spec is downloaded automatically in CI.
  • Projects that accept specs from contributors or customers, for example through pull requests or an upload feature.
  • Developer workstations and build servers running Refitter, because the generated code is compiled and may be run in tests.
  • Agencies and integrators who regenerate clients for many different client APIs.

The research does not report any exploitation in the wild, and it does not show a listing in CISA's Known Exploited Vulnerabilities catalog. Only one independent publisher covers this story so far, so treat details beyond the advisory as unconfirmed.

How to check your exposure

First find out which Refitter version you use. If you installed it as a .NET global tool, this read-only command lists installed tools and their versions. Look for refitter with a version below 2.1.2.

List installed .NET global tools and versions (any OS with the .NET SDK)Shell
dotnet tool list --global

If Refitter is a local tool, this read-only command shows the tool versions from the manifest. Run it in the repository root and look for Refitter below 2.1.2.

List local .NET tools from the tool manifest (run in the repository root)Shell
dotnet tool list

If Refitter is a package reference in a project, this read-only command lists the project's NuGet packages. Run it in the project folder and look for Refitter below 2.1.2.

List NuGet packages for a project, including Refitter if referenced (run in the project folder)Shell
dotnet list package

Then review where your OpenAPI files come from. Any spec that was fetched from outside your control, or edited by people outside your team, deserves a second look before you trust code generated from it.

What to do now

  1. Upgrade Refitter to 2.1.2 or later on every developer machine, build agent and CI image.
  2. Regenerate clients that were produced with an affected version from OpenAPI files you did not fully control, then review the diff of the generated files.
  3. Inspect generated C# files for unexpected top-level classes or ModuleInitializer methods that do not belong to your project.
  4. Stop fetching OpenAPI descriptions from untrusted URLs during builds; pin specs in source control and review changes to them.
  5. If an untrusted spec was ever used with an affected version, treat the build machine and any secrets it holds as potentially exposed and rotate those secrets.
  6. Add a review step for generated code in pull requests so injected classes are visible to a human.

To update a global tool to the latest release, use the standard update command below. Afterward, run the list command again and confirm the version is 2.1.2 or higher.

Update the Refitter global tool to the latest version (requires the .NET SDK)Shell
dotnet tool update --global Refitter
Tip. If Refitter is a package reference rather than a tool, update the version in your project file or with your usual NuGet workflow, then rebuild and regenerate clients.
Caution. Updating alone does not remove code that was already injected into previously generated files. If you committed generated output from an untrusted spec, regenerate it and review it.

Detection and follow-up

The advisory's suggested fix is to escape every spec-derived string before it is emitted into a Refit attribute, reject newlines and validate characters, using one shared encoder. That is a useful principle for your own code generators too: anything that comes from an input file and lands in source code needs consistent escaping.

For ongoing hygiene, track the advisory for updates, and keep an eye on the dependencies in your build chain, not only the ones in your shipped application. If your team publishes web services, a read-only check of what is exposed from the outside can complement this work, for example with Webforta Scan, though it cannot see inside your build pipeline. For background on tracking known vulnerabilities in the components you depend on, see Is my WordPress plugin vulnerable? for the general approach.

Timeline

Dates as stated in the advisory and CVE record
DateEvent
Jun 30, 2026Advisory published in the christianhelle/refitter repository (per GitHub)
Oct 30, 2026Published by the National Vulnerability Database
Nov 20, 2026Published to the GitHub Advisory Database and reviewed

Sources

This article is based on the public sources below. Details can change as vendors and researchers publish more; check the original advisories before acting on version numbers.

  1. CVE-2026-63344 - GitHub Advisory Databasegithub.com
  • Refitter
  • CVE-2026-63344
  • OpenAPI
  • NuGet
  • code injection
  • .NET