Description
fastapi-code-generator creates FastAPI applications from OpenAPI files. Prior to 0.8.1, the generator inserts Operation.summary into a generated route-handler docstring as a triple-double-quoted string without escaping embedded triple quotes. An attacker-controlled or attacker-influenced operation summary can close the docstring and inject a valid Python expression statement into the handler body. Syntax-breaking input only causes generation to fail, but syntactically valid generated code executes with the server process's privileges when the affected route handler is called. This call-time route-handler docstring sink is distinct from the project's separate import-time route-path and additional-response-key sinks. This issue is fixed in version 0.8.1.
Published: 2026-11-03
Score: 9.3 Critical
EPSS: < 1% Very Low
KEV: No
Impact: Remote Code Execution
Action: Apply Patch
AI Analysis

Impact

The vulnerability arises when fastapi-code-generator inserts the operation.summary field from an OpenAPI specification directly into a generated route‑handler docstring without escaping embedded triple quotes. An attacker who can influence the operation.summary can terminate the docstring and inject a valid Python expression statement into the handler body. When the affected route handler is invoked, the injected code runs with the server process’s privileges, providing full remote code execution. This is a classic code‑injection flaw, classified as CWE‑94 and CWE‑116, with a CVSS score of 9.3 indicating critical severity.

Affected Systems

The flaw exists in the koxudaxi fastapi-code-generator product. All product releases prior to version 0.8.1 are affected. Any FastAPI application that was generated by this tool using an older version, especially when the OpenAPI specification’s operation summaries are under attacker control, could be vulnerable.

Risk and Exploitability

Without a patch, an attacker who can supply or modify the OpenAPI specification used to generate the application can embed arbitrary Python code. Because the exploitation occurs at runtime when the route is called, the attack requires the target server to host the generated application. The EPSS score is not available, and the vulnerability is not listed in CISA KEV. The CVSS score of 9.3 demonstrates high impact and potential for widespread exploitation if untrusted OpenAPI definitions are used.

Generated by OpenCVE AI on November 3, 2026 at 20:38 UTC.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade fastapi-code-generator to version 0.8.1 or later, which escapes operation summaries before inserting them into docstrings.
  • If upgrading is not immediately possible, sanitize or remove any operation summaries that originate from untrusted sources before feeding them to the generator; replace triple quotes or escape the string content.
  • Avoid using external or mutable OpenAPI specifications for code generation; prefer manually authored FastAPI code or a trusted source for schemas.
  • Consider disabling the automatic inclusion of operation.* fields in generated docstrings or removing the feature altogether if it is not needed for documentation purposes.

Generated by OpenCVE AI on November 3, 2026 at 20:38 UTC.

Tracking

Sign in to view the affected projects.

Advisories

No advisories yet.

History

Tue, 03 Nov 2026 20:30:00 +0000

Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'yes', 'Exploitation': 'poc', 'Technical Impact': 'total'}, 'version': '2.0.3'}


Tue, 03 Nov 2026 19:30:00 +0000

Type Values Removed Values Added
Description fastapi-code-generator creates FastAPI applications from OpenAPI files. Prior to 0.8.1, the generator inserts Operation.summary into a generated route-handler docstring as a triple-double-quoted string without escaping embedded triple quotes. An attacker-controlled or attacker-influenced operation summary can close the docstring and inject a valid Python expression statement into the handler body. Syntax-breaking input only causes generation to fail, but syntactically valid generated code executes with the server process's privileges when the affected route handler is called. This call-time route-handler docstring sink is distinct from the project's separate import-time route-path and additional-response-key sinks. This issue is fixed in version 0.8.1.
Title fastapi-code-generator: Call-time RCE via operation summary -> unescaped route-handler docstring
Weaknesses CWE-116
CWE-94
References
Metrics cvssV4_0

{'score': 9.3, 'vector': 'CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N'}


Subscriptions

No data.

cve-icon MITRE

Status: PUBLISHED

Assigner: GitHub_M

Published:

Updated: 2026-11-03T19:34:47.499Z

Reserved: 2026-07-16T21:37:45.769Z

Link: CVE-2026-63470

cve-icon Vulnrichment

Updated: 2026-11-03T19:34:43.036Z

cve-icon NVD

Status : Deferred

Published: 2026-11-03T20:18:15.590

Modified: 2026-11-03T20:31:38.783

Link: CVE-2026-63470

cve-icon Redhat

No data.

cve-icon OpenCVE Enrichment

Updated: 2026-11-03T20:45:01Z

Weaknesses
  • CWE-116

    Improper Encoding or Escaping of Output

  • CWE-94

    Improper Control of Generation of Code ('Code Injection')