Code injection in fastapi-code-generator via response status-code key
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 before 0.8.1 builds FastAPI applications from OpenAPI files. It writes an extra response status-code key as a single-quoted string without escaping quotes. An attacker who influences a non-primary response key in a multi-response OpenAPI operation can inject a Python expression. The injected code 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-03
Description from the CNA
fastapi-code-generator creates FastAPI applications from OpenAPI files. Prior to 0.8.1, the generator inserts an additional response status-code key into the generated responses={...} route-decorator dictionary as a single-quoted Python string without escaping embedded quotes. A multi-response OpenAPI operation with an attacker-controlled or attacker-influenced second non-primary response key can close the dictionary-key literal and inject a valid Python expression. 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 its decorator arguments are evaluated. This additional-response-key sink is distinct from the project's separate route-path and operation-summary sinks. This issue is fixed in version 0.8.1.
Why it matters now
SSVC decision points
Not available: CISA has not published SSVC decision points for this record.
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-03
- Fix · CNA fastapi-code-generator (koxudaxi) Fixed in 0.8.1
Timeline
- 2026-11-03 Threatist record created from CVE-2026-63469
References
Other 4
- https://github.com/koxudaxi/fastapi-code-generator/security/advisories/GHSA-6xmv-cjr5-w3q8
- 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-84481 Code injection in fastapi-code-generator via OpenAPI route paths CVSS 4.0CRITICAL 9.3
- 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
Sources
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences