Code injection in fastapi-code-generator via OpenAPI route paths
Key facts
- Attack vector
- Network
- Privileges required
- None
- User interaction
- None
- Attack complexity
- Low
- Attack requirements
- None
- Impact type
- Code execution
- Confidentiality · integrity · availability
- High · High · High
- Fix status
- Fixed
Attack profile from CVSS 4.0 · CNA. Fix status from CNA. Impact type from CWE-94.
Summary
fastapi-code-generator versions before 0.8.1 create FastAPI applications from OpenAPI files. The generator inserts an OpenAPI path into a generated route decorator inside a single-quoted string without escaping embedded quotes (CWE-116, CWE-94). An attacker who controls or influences the OpenAPI path can close the string and inject a Python expression that runs with the application's or CI process's privileges when the generated module is imported.
Written with Claude Haiku 5.5 from the sources below · 2026-11-07
Description from the CNA
fastapi-code-generator creates FastAPI applications from OpenAPI files. Prior to 0.8.1, the generator inserts an OpenAPI path into a generated @app.get(...) route decorator as a single-quoted generated route string without escaping embedded quotes. An attacker-controlled or attacker-influenced OpenAPI path can close the string and inject a valid Python expression into the decorator argument. Syntax-breaking input only causes generation to fail, but syntactically valid generated code executes with the application's or CI process's privileges when the generated module is imported and the decorator is evaluated. This OpenAPI path sink is distinct from the project's separate operation-summary docstring and additional-response-key sinks. This issue is fixed in version 0.8.1.
Why it matters now
SSVC decision points
CISA ADP · SSVC 2.0.3
- Exploitation
- Poc
- Automatable
- Yes
- Technical impact
- Total
The decision (Track, Attend, Act) also depends on your mission and well-being impact; see CISA's SSVC guide.
Affected products
Remediation
Upgrade fastapi-code-generator to version 0.8.1, which fixes this issue.
Written with Claude Haiku 5.5 from the sources below · 2026-11-07
- Fix · CNA fastapi-code-generator (koxudaxi) Fixed in 0.8.1
Timeline
- 2026-11-03 Threatist record created from CVE-2026-63471
- 2026-11-07 CISA SSVC decision points changed
- 2026-11-07 Priority changed: MEDIUM → HIGH
References
Other 4
- https://github.com/koxudaxi/fastapi-code-generator/security/advisories/GHSA-p2mm-64f6-gmpp
- https://github.com/koxudaxi/fastapi-code-generator/commit/49301dbdb82170d7f50877419d994b05cb1fa2bc
- https://github.com/koxudaxi/fastapi-code-generator/commit/b3b9bd66e0b0c4d8c686fda700258104615a1332
- https://github.com/koxudaxi/fastapi-code-generator/releases/tag/0.8.1
More koxudaxi vulnerabilities
- TI-2026-84480 Code injection in fastapi-code-generator route docstrings CVSS 4.0CRITICAL 9.3
- TI-2026-39961 Arbitrary local file read via XSD `schemaLocation` (`xs:include`/`xs:import`) path traversal, with no remote-ref gate CVSS 3.1HIGH 7.5
- TI-2026-39960 Information disclosure in koxudaxi datamodel-code-generator CVSS 3.1HIGH 7.5
- TI-2026-39512 datamodel-code-generator vulnerable to SSRF via --url: no host/IP validation, follows redirects CVSS 3.1HIGH 8.2
- TI-2026-39511 datamodel-code-generator vulnerable to SSRF via JSON-Schema `$ref` to HTTP URL (silent by default) CVSS 3.1HIGH 8.2
- TI-2026-39483 Code injection in koxudaxi datamodel-code-generator CVSS 3.1HIGH 7.8
Sources
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences