Intel

AIKIDO-2026-928976

fastapi-code-generator is vulnerable to Code Injection

CVE-2026-63469Published 4 days ago
November 5, 2026

93

CVE Score

Critical

Code Injection

Are you affected? Scan for Free

TL;DR

Before the fix, parse_responses stored each non-primary response status-code key from the parsed raw_obj raw, and the generator wrote it into the route decorator's responses={...} dict as a single-quoted string without escaping. Anyone who controls or influences the OpenAPI document could close the key literal with a quote and inject a Python expression that ran when the generated module was imported by the application or CI. An operation needed a second response for the dict to be emitted, and syntax-breaking keys only aborted generation. The fix escapes every additional response status-code key with PythonEscapedString.single_quoted, blocking the injection.

How do I fix this?

Upgrade the fastapi-code-generator package to 0.8.1 or later.

Who does this affect?

You are affected if you are using a version that falls within the vulnerable range and generate apps from an OpenAPI document you do not fully control and import the generated code, with an operation declaring a second response.

Versions

0.3.1 - 0.8.0

Fixed in 0.8.1

Background info

fastapi-code-generator is vulnerable to Code Injection in versions 0.3.1 - 0.8.0.

Get secure today,
quickly and for free.

Secure your code, cloud, and runtime in one central system. Connect a repo to discover what the reasoning agents find in your codebase.

No credit card required | Scan results in 32 seconds.

Trusted by 150k+ orgs
  • Revolut
  • n8n
  • Lovable
  • Deel
  • Prove
  • Omnea