Improper Encoding or Escaping of Output Affecting fastapi-code-generator package, versions [,0.8.1)


Severity

Recommended
0.0
critical
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of Concept
EPSS
0.51% (45th percentile)

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications
  • Snyk IDSNYK-PYTHON-FASTAPICODEGENERATOR-23052680
  • published30 Nov 2026
  • disclosed9 Nov 2026
  • creditAli Sadeghi, Maryam Rostamipoor

Introduced: 9 Nov 2026

NewCVE-2026-63470  (opens in a new tab)
CWE-116  (opens in a new tab)
CWE-94  (opens in a new tab)

How to fix?

Upgrade fastapi-code-generator to version 0.8.1 or higher.

Overview

fastapi-code-generator is a Generate a FastAPI app from an OpenAPI file.

Affected versions of this package are vulnerable to Improper Encoding or Escaping of Output via the summary field of an OpenAPI operation being emitted as an unescaped triple-double-quoted docstring in the generated route handler. Because """ sequences in the summary value are not escaped before being written into the handler body, an attacker who controls or influences the OpenAPI spec can inject a valid Python expression that closes the docstring and is evaluated as a live expression statement. This injected code executes on the server each time the affected endpoint is called.

PoC

`reproduce.sh` (+ `make_spec.py`) attached: generates the app and calls the route handler; the injected expression runs and writes a marker. Verified on 0.8.0.

Note: The PoC states it was verified on fastapi-code-generator 0.8.0.

CVSS Base Scores

version 4.0
version 3.1