All vulnerabilities

PyPI

CVE-2026-63471

fastapi-code-generator: Import-time RCE via route path -> unescaped @app.get('...') decorator

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 41% of CVEs. EPSS by FIRST, 24 Nov 2026
Weakness
Improper output encoding (CWE-116)Code injection (CWE-94)
Also known as
GHSA-p2mm-64f6-gmpp
Sources
OSV.dev and GitHub

Description

fastapi-code-generator (koxudaxi) emits the OpenAPI path into the generated main.py route decorator as a single-quoted string literal (@app.get('/u//x')) without escaping the '. A ' in the path closes the decorator 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 needed. The path is a pure data field. Verified on fastapi-code-generator 0.8.0 / Python 3 / FastAPI.

The generator post-processes output 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. info.description (description='…'), tags, and parameter defaults are '-escaped; the path in @app.get('…') is the unescaped sink. Models come from datamodel-code-generator (repr-escaped, no RCE).

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

References