It affects applications generated from an attacker-controlled or attacker-influenced OpenAPI specification.The flaw places an operation summary into generated Python without safely escaping the docstring context. The injected expression runs with the server process's privileges when the affected route handler is called.
What it allows
How Does CVE-2026-63470 Lead to Remote Code Execution?
fastapi-code-generator treats an OpenAPI operation summary as data, but writes it into a generated route-handler docstring without sufficient escaping. Crafted summary content can cross that boundary and become a valid Python expression in the handler body.
The attack has two stages. A developer first generates an application from a malicious or influenced specification. The resulting code then executes the injected expression when the affected endpoint is called.
Input that breaks Python syntax only stops generation. The security impact arises when the generated application remains syntactically valid and the affected handler later runs with the server process's privileges.
Who is affected
All fastapi-code-generator versions before 0.8.1 are affected. GitHub's advisory identifies version 0.8.1 as patched.
Exposure depends on the provenance of OpenAPI specifications used for generation. Teams that generated applications from untrusted, externally supplied, or externally influenced specifications should treat those outputs as higher priority for review.
What to do
-
Upgrade the generator to version 0.8.1 or later
Replace vulnerable fastapi-code-generator versions before generating or regenerating applications. Confirm the build environment resolves version 0.8.1 or a later release.
-
Inventory generated applications and source specifications
Identify applications produced with versions before 0.8.1. Record the OpenAPI specification source and whether an external party could influence operation summaries.
-
Regenerate and compare affected outputs
Regenerate applications from trusted specifications with a fixed generator. Brandefense recommends reviewing differences in route-handler docstrings before deployment.
-
Review existing generated handlers
Inspect generated route-handler docstrings and nearby expressions for unexpected content. Prioritize applications built from specifications whose origin or change history cannot be verified.
-
Investigate suspicious runtime behavior
Brandefense recommends reviewing application and process telemetry for unexpected child processes, file changes, or outbound activity after affected handlers were called.
What Brandefense can do
- Scan your domain in Brandefense Atlas, free
Atlas checks public sources for leaked credentials, phishing domains, dark web mentions and data sales, then gives your domain a risk grade. Free, no sign-up.
- Vulnerability Intelligence
Brandefense Vulnerability Intelligence follows which vulnerabilities attackers are using, so your team can patch what is under attack first.
Frequently Asked Questions
What is CVE-2026-63470?
It is a critical remote code execution vulnerability in fastapi-code-generator. Unsafe handling of an OpenAPI operation summary can place executable Python into a generated route handler.
Which fastapi-code-generator versions are affected?
GitHub's advisory marks every version before 0.8.1 as affected. Version 0.8.1 is the patched release.
When does the injected code run?
The advisory says it runs when the affected generated route handler is called. This differs from an import-time flaw.
What should defenders do after upgrading?
Inventory applications generated with older versions, verify specification provenance, regenerate trusted projects, and review existing handlers and runtime telemetry.
Is CVE-2026-63470 in CISA KEV?
No. It was not listed in CISA's Known Exploited Vulnerabilities catalog as of November 9, 2026.
