Skip to content
PatchBriefing

Search PatchBriefing

Type at least two characters. Results update as you type.

Search CVEs, products, packages and article titles.

Nothing found. Identifiers such as CVE and GHSA can be searched in both languages.

Subscribe

Critical · 9.3 Critical vulnerabilities CVE-2026-63470

CVE-2026-63470: Code Injection in fastapi-code-generator via Unescaped Operation Summary

fastapi-code-generator, a tool that builds FastAPI applications from OpenAPI files, contains a code injection flaw where an attacker-controlled operation summary can break out of a generated docstring and inject executable Python code into a route handler. The issue is fixed in version 0.8.1.

By PatchBriefing ·

Produced automatically from official sources with the help of AI. How we work →

Synthesized by AI from 1 source · updated 1 week ago
Sources · merged by AI 1 total

AI summary

A vulnerability has been disclosed in fastapi-code-generator, a tool that generates FastAPI application code from OpenAPI specification files. The flaw allows an attacker who can influence the content of an OpenAPI operation summary to inject arbitrary Python code into the generated route-handler source. This briefing summarizes what is known, who is affected, and what action to take.

What happened

fastapi-code-generator inserts the value of an OpenAPI Operation.summary field into a generated route-handler docstring, formatted as a triple-double-quoted Python string. Prior to version 0.8.1, the generator does not escape embedded triple quotes in that value. If an operation summary contains a sequence that closes the triple-quoted docstring early, an attacker can append a syntactically valid Python expression statement that becomes part of the generated handler's code body, rather than remaining inert documentation text.

Technical cause

The root cause (CWE-94, Improper Control of Generation of Code) is missing input sanitization when embedding the operation summary into a triple-quoted docstring during code generation. Because the summary string is not escaped, an attacker-controlled or attacker-influenced summary value can terminate the docstring prematurely and inject a new Python statement. If the injected input is not valid Python, code generation simply fails; but if it is syntactically valid, it becomes live code in the generated handler. The advisory notes this route-handler docstring sink is distinct from other, previously identified injection points in the same project involving route paths and additional response keys at import time — this flaw specifically affects code that executes when the generated route handler is called, i.e., at request time.

Why it matters

Because the injected code executes with the privileges of the server process whenever the affected route handler is invoked, successful exploitation can lead to full compromise of confidentiality, integrity, and availability of the generated application. The vulnerability is rated with a CVSS base score of 9.3, reflecting that it can be triggered over the network, requires no privileges, and needs no user interaction, and that it affects the handler at the point it is actually called — not just during an isolated build step.

Who is affected

Any project that uses fastapi-code-generator to produce FastAPI application code from an OpenAPI file is potentially affected, specifically where the content of operation summaries in the OpenAPI specification can be influenced by an untrusted party (for example, specifications sourced from external or semi-trusted contributors) and where the generated code is deployed and executed.

Affected versions

Versions of fastapi-code-generator prior to 0.8.1 are affected. The issue is fixed in version 0.8.1.

Fixes and mitigation

The vendor has released version 0.8.1, which fixes this issue. Projects using fastapi-code-generator should update to this version. The fact package does not describe any additional workaround beyond upgrading, so no other mitigation is confirmed at this time.

Recommended action

Update fastapi-code-generator to version 0.8.1 or later. Review any OpenAPI specification files processed by the generator, especially those that may include operation summaries from untrusted or external sources, and regenerate affected application code after upgrading.

PatchBriefing score

9.3 / 10 · Critical

Official CVSS: 9.3

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

EPSS 0.0054 (39 percentile)

Why this score

The PatchBriefing score equals the official CVSS score; when this article covers several vulnerabilities, the highest one. Signals such as known exploitation and EPSS are listed separately and do not change the score.

Affected versions

Reported fixes

The vendor has released version 0.8.1, which fixes this issue. Projects using fastapi-code-generator should update to this version. The fact package does not describe any additional workaround beyond upgrading, so no other mitigation is confirmed at this time.

How this was built

1 source records were collected, matched and used to prepare the report above.

  • NVD (NIST) database
Unified report
CVE-2026-63470: Code Injection in fastapi-code-generator via Unescaped Operation Summary
1 article · 1 sources cited
Revision history
  1. Published
  2. Generated
The Morning Brief

Relevant changes for the stacks you follow.

Choose your stacks, topics and optional WordPress plugins. At 07:00 CET, matching advisories and releases from the reporting period are grouped into one email.

✓ Choose stacks and topics✓ Change preferences anytime✓ One grouped email