Skip to main content

fastapi-code-generator EUVDEUVD-2026-116145

| CVE-2026-63470 CRITICAL
Code Injection (CWE-94)
2026-11-03 GitHub_M
9.3
CVSS 4.0 · Vendor: GitHub_M
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Supply attacker-influenced OpenAPI spec
  2. Delivery
    Set triple-quote breakout in operation summary
  3. Exploit
    Generator emits unescaped payload into handler docstring
  4. Execution
    Operator deploys generated FastAPI app
  5. Persist
    Invoke affected route endpoint
  6. Impact
    Execute arbitrary code as server process

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V1 - Encoding and Sanitization Code injection prevention, sandbox exec
MITRE ATT&CK

2 techniques across 2 tactics: Execution, Initial Access

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Exploitation Conditions

Exploitation requires that a FastAPI application be generated by fastapi-code-generator (< 0.8.1) from an OpenAPI spec whose Operation.summary field is attacker-controlled or attacker-influenced, and that the generated application then be deployed and the affected route handler actually invoked (the injected expression runs at call time, not at generation time). The payload must be syntactically valid Python that survives the generator's black/isort post-processing - the advisory's technique is '"""+expr+"""' kept valid via '(expr or "")'; a syntax-breaking summary only aborts generation and does not produce a vulnerable artifact. Limiting factors: the attacker needs write influence over the summary data field of the consumed spec, an operator must run the generator and deploy the output, and only the summary-in-handler-docstring path is affected (info.description, tags, parameter defaults are escaped, and models from datamodel-code-generator are repr-escaped). Risk is therefore real only in workflows that generate code from untrusted specs.

Impact

The vendor CVSS 4.0 vector (AV:N/AC:L/AT:N/PR:N/UI:N, VC:H/VI:H/VA:H) scores this 9.3 Critical and the vuln.today decision label is act_now, signaling it should be remediated immediately. However, the signals must be read against the mechanism: this is a code-generation (build-time) developer tool, and the injected Python only executes at call time inside an application that was GENERATED from an attacker-controlled or attacker-influenced OpenAPI spec and then deployed. The PR:N/UI:N framing implies trivial drive-by remote exploitation, but the real precondition is attacker influence over the operation 'summary' field of the spec consumed by the generator, plus an operator who runs the generator and deploys the resulting handler - so realistic exposure is concentrated in CI/codegen pipelines that build FastAPI apps from untrusted or third-party specs, not in arbitrary internet-facing hosts. No CISA KEV entry is present in the input and no EPSS score was provided, so there is no evidence of active or widespread exploitation; the urgency rests on the act_now label, the Critical rating, and the existence of a reporter PoC rather than on observed in-the-wild activity. Net: a genuine high-impact RCE worth prioritizing wherever specs are untrusted, but materially narrower in real-world reach than the raw 9.3 implies - treat the no-conditions reading of the CVSS as optimistic for the attacker.

Exploit ScenarioDerived

An organization auto-generates a FastAPI service from a third-party or user-supplied OpenAPI document; an attacker sets an operation's summary to a triple-quote breakout such as '"""+(__import__("os").system(...) or "")+"""', which fastapi-code-generator writes unescaped into the route handler's docstring as a live expression statement. Once the generated app is deployed, the first request to that endpoint executes the injected code at call time with the server process's privileges. A reporter PoC (reproduce.sh/make_spec.py) demonstrating this was attached to the GHSA advisory and verified on 0.8.0.

Act Now Prioritize within 24-48h. Why: CRITICAL severity.
Patch available

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Nov 03, 2026

Code generation in fastapi-code-generator before 0.8.1 writes an OpenAPI Operation.summary verbatim into the generated route handler's triple-double-quoted docstring without escaping embedded """, so a crafted summary can close the docstring and inject a Python expression statement into the handler body that executes with the server process's privileges when that endpoint is called. Only code generated from an attacker-controlled or attacker-influenced spec and subsequently deployed is exposed; a syntax-breaking payload merely aborts generation (black/isort post-processing), so the practical payload must be valid Python such as the advisory's '"""+expr+"""' form kept valid with '(expr or "")'. The vendor CVSS 4.0 vector scores 9.3 Critical, our independent assessment is CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H (UI:R reflecting that an operator must generate and deploy the code), and the vuln.today decision label is act_now; a public PoC reference exists (reproduce.sh attached to the GitHub advisory, verified against 0.8.0) and no CISA KEV entry applies.

RemediationAI

Upgrade fastapi-code-generator to 0.8.1 or later, which escapes operation summaries for docstring context (vendor-released patch: 0.8.1; corresponding fixes in commits 49301dbdb82170d7f50877419d994b05cb1fa2bc and b3b9bd66e0b0c4d8c686fda700258104615a1332, release notes at https://github.com/koxudaxi/fastapi-code-generator/releases/tag/0.8.1). After upgrading, regenerate and redeploy affected applications, since previously generated source retains the injected or unescaped text. If upgrading must be deferred, generate only from specs you fully trust and treat the summary field of third-party specs as hostile - strip or reject """ and backslash sequences from Operation.summary before running the generator, with the trade-off that legitimate summaries containing quoted text will be altered or dropped; alternatively inspect the generated handler docstrings and bodies before deployment, which is a manual review step that does not scale and does not protect spec pipelines that regenerate automatically. Note that a rejected or malformed summary typically stops generation rather than silently producing safe code, so pipeline failures should be treated as a signal of hostile input.

Affected VersionsENISA

fastapi-code-generator < 0.8.1

Affected Packages

euvd fastapi_code_generator fix: 0.8.1

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 1 package in euvd

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

fastapi-code-generator is a Python tool that converts OpenAPI documents into FastAPI application source, then formats the result with black and isort. The root cause is CWE-94 (improper control of code generation) compounded by CWE-116 (improper encoding of output): the parser modeled Operation.summary as ordinary text and emitted it into the handler docstring inside a """...""" literal, so a summary containing a triple quote terminates the string and lets the remainder concatenate an arbitrary expression into the function body. Because the injected text lands in an expression statement, it runs at request time when the route handler is invoked, not at import or generation time; this call-time docstring sink is distinct from the project's separate import-time sinks (route path emitted into the @app.get decorator, additional response keys). The upstream fix in 0.8.1 introduces a PythonEscapedString type with single_quoted and triple_double_quoted escaping helpers (backslash doubling plus escaping """) and applies it in model_post_init to summary, path, tags and additional_responses status codes. The advisory notes that info.description, tags and parameter defaults were already escaped and that models produced by datamodel-code-generator are repr-escaped, which bounds the affected field to the operation summary rendered as a handler docstring.

Know when Python gets its next vulnerability

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (GitHub_M) PRIMARY 9.3 CRITICAL
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
vuln.today AI 8.8 HIGH

Payload crafting is deterministic (AC:L) and needs no privileges on the target (PR:N), but a developer must generate and deploy code from the attacker-influenced spec, so UI:R; full code execution gives C/I/A:H.

3.1 AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
4.0 AV:N/AC:L/AT:N/PR:N/UI:A/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N

Primary rating from Vendor (GitHub_M).

CVSS VectorVendor: GitHub_M

Attack Vector
Network
Attack Complexity
Low
Attack Requirements
None
Privileges Required
None
User Interaction
None
Vulnerable system: Confidentiality
High
Vulnerable system: Integrity
High
Vulnerable system: Availability
High
Subsequent system: Confidentiality
None
Subsequent system: Integrity
None
Subsequent system: Availability
None

Lifecycle Timeline

2
Patch available
Nov 03, 2026 - 20:02 EUVD
CVE Published
Nov 03, 2026 - 19:13 cve.org
CRITICAL 9.3

DescriptionCVE.org

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.

Technical POC Analysis

The bug is CWE-94: the generator constructs Python source code from externally influenced input without neutralizing syntax-significant characters.

Full technical POC analysis - root cause, step-by-step exploitation and patch breakdown - is part of the Pro and Business plans.

Executive ViewAI

Why It Matters

CVE-2026-63470 is a CRITICAL code-injection flaw in fastapi-code-generator that can cause attacker-controlled code to be silently embedded into the route handlers your teams generate and deploy as production services. Because the injection executes with the server process's privileges, a compromised API service can expose data and allow modification or disruption of the affected application. Leadership should care because remediation requires developer workflow changes, not just a server patch, and unpatched versions remain in use until generation pipelines are updated and any previously generated code is reviewed.

Business Impact: High
Compensating Controls

No vendor-released patch identified at time of analysis. Interim mitigations: restrict code generation to trusted, internally controlled OpenAPI specifications; scan and review generated docstrings for embedded expression fragments before deployment; run generation in isolated, low-privilege build environments; apply least privilege to server processes that execute generated handlers; monitor deployed services for unexpected outbound activity or process behavior.

Threat Intelligence Overview

Prevalence
Low
niche Python code-generation developer tool, limited production runtime footprint
Data Quality
5 sources
Confidence: Medium
EUVD NVD CVE.org Vulnrichment GitHub

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity CRITICAL
CISA KEV No
Public POC No
EPSS N/A
Patch available Yes
Active threat No
Deciding rule
CRITICAL severity
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision
Scheduled
Exploitation
Poc
System Exposure· derived
Open
Automatable
Yes
Human Impact
High
Technical Impact
Total

Priority Score

46
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +46
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Code Injection CRITICAL

Code injection occurs when an application accepts user input and passes it directly into a language interpreter or evaluator without proper sanitization.

Remote Code Execution represents the critical moment when an attacker successfully runs arbitrary code on a target system without physical access.

More in Python

View all
CVE-2025-24016 CRITICAL POC
9.9 Feb 10

Wazuh SIEM platform versions 4.4.0 through 4.9.0 contain an unsafe deserialization vulnerability in the DistributedAPI t

CVE-2025-27520 CRITICAL POC
9.8 Apr 04

BentoML version 1.4.2 and earlier contains an unauthenticated remote code execution vulnerability through insecure deser

CVE-2025-2945 CRITICAL POC
9.9 Apr 03

pgAdmin 4 contains critical remote code execution vulnerabilities in the Query Tool download and Cloud Deployment endpoi

CVE-2013-5093 MEDIUM POC
6.8 Sep 27

The renderLocalView function in render/views.py in graphite-web in Graphite 0.9.5 through 0.9.10 uses the pickle Python

CVE-2025-32375 CRITICAL POC
9.8 Apr 09

BentoML is a Python library for building online serving systems optimized for AI apps and model inference. Rated critica

CVE-2014-0224 HIGH POC
7.4 Jun 05

OpenSSL before 0.9.8za, 1.0.0 before 1.0.0m, and 1.0.1 before 1.0.1h does not properly restrict processing of ChangeCiph

CVE-2024-21644 HIGH POC
7.5 Jan 08

pyLoad download manager version prior to 0.5.0b3.dev77 exposes the Flask SECRET_KEY through an unauthenticated endpoint.

CVE-2026-33017 CRITICAL POC
9.3 Mar 17

Langflow (a visual LLM pipeline builder) contains a critical unauthenticated code execution vulnerability (CVE-2026-3301

CVE-2017-9462 HIGH POC
8.8 Jun 06

In Mercurial before 4.1.3, "hg serve --stdio" allows remote authenticated users to launch the Python debugger, and conse

CVE-2026-49869 CRITICAL POC
10.0 Jun 26

Unauthenticated remote code execution affects Kestra OSS (the open-source event-driven orchestration platform) prior to

CVE-2026-39987 CRITICAL POC
9.3 Apr 08

Unauthenticated remote code execution in Marimo ≤0.20.4 allows attackers to execute arbitrary system commands via the `/

CVE-2024-21645 MEDIUM POC
5.3 Jan 08

pyLoad is the free and open-source Download Manager written in pure Python. Rated medium severity (CVSS 5.3), this vulne

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy