PyPI
CVE-2026-63470
fastapi-code-generator: Call-time RCE via operation summary -> unescaped route-handler docstring
- 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
- Also known as
- GHSA-h667-4jj2-cgv4
- Sources
- OSV.dev and GitHub
Description
fastapi-code-generator (koxudaxi) emits an operation's summary as the generated route handler's docstring, using a triple-quoted string without escaping """. A """ in the summary closes the docstring and, via concatenation, injects a live expression that becomes an expression statement in the handler body -- which runs when the route handler is CALLED (the endpoint is hit). The summary is a pure data field. Verified on fastapi-code-generator 0.8.0 / Python 3 / FastAPI.
The generator post-processes with black/isort, so a syntax-breaking payload aborts generation; a valid-Python breakout ("""+expr+""", kept valid with (… or "")) is written and executes at call time. info.description, tags, parameter defaults are escaped; operation description is not emitted into the function body; the summary in the handler docstring is the unescaped sink. Models come from datamodel-code-generator (repr-escaped, no RCE).
Affected software
| Software | Affected versions |
|---|---|
fastapi-code-generatorPyPI · osv:PyPI:fastapi-code-generator |
|
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
- CVE-2026-63471fastapi-code-generator: Import-time RCE via route path -> unescaped @app.get('...') decoratorCritical 9 Nov 2026
- CVE-2026-63469fastapi-code-generator: Import-time RCE via response status-code key -> unescaped @app.get(..., responses={...}) dictCritical 9 Nov 2026
References
- CVE.org https://www.cve.org/CVERecord?id=CVE-2026-63470
- GitHub Advisory Database https://github.com/advisories/GHSA-h667-4jj2-cgv4