All vulnerabilities

PyPI

CVE-2026-63469

fastapi-code-generator: Import-time RCE via response status-code key -> unescaped @app.get(..., responses={...}) dict

Severity
Critical
Published
9 Nov 2026
Last changed
9 Nov 2026
Added to UpHeron
23 Nov 2026
Fixed in
0.8.1
Exploit chance
0.5% in the next 30 daysHigher than 43% of CVEs. EPSS by FIRST, 24 Nov 2026
Weakness
Improper output encoding (CWE-116)Code injection (CWE-94)
Also known as
GHSA-6xmv-cjr5-w3q8
Sources
OSV.dev and GitHub

Description

fastapi-code-generator (koxudaxi) emits an operation's extra responses into the route decorator's responses={...} dict, using each response's status-code key as a single-quoted string literal without escaping the '. A ' in a status-code key closes the dict-key string and, via concatenation, injects a live expression that the decorator argument evaluates when main.py is imported (the ASGI server imports it at startup) -- code execution, no request. The status-code key is a pure data field. Verified on fastapi-code-generator 0.8.0 / Python 3 / FastAPI.

The responses={...} dict is emitted only when the operation has a second (non-primary) response, so the malicious key is any additional response status. The generator post-processes with black/isort, so a syntax-breaking payload aborts generation (DoS); a valid-Python concat ('+expr+', kept valid with (... or "")) is written and runs at import. The response content-type key is NOT a sink (normalized to 'model').

From the GitHub Advisory Database, CC BY 4.0. Shortened; the full text is there.

Affected software

SoftwareAffected versions
fastapi-code-generatorPyPI · osv:PyPI:fastapi-code-generator
  • Every version before 0.8.1

About fastapi-code-generator

Weekly downloads (PyPI)
14,234PyPI Stats, 24 Nov 2026

Vulnerabilities in fastapi-code-generator

In our list
3
Published in the last 12 months
3
Critical, last 12 months
3
High, last 12 months
0
Known exploited
0
Search the list for fastapi-code-generator

References