{"id":"CVE-2026-63471","kind":"vulnerability","aliases":["CVE-2026-63471"],"related":[],"title":"fastapi-code-generator: crafted OpenAPI path injects Python code into generated apps","description":"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.","summary":"fastapi-code-generator turns OpenAPI files into FastAPI applications, but before 0.8.1 it pasted OpenAPI path strings into generated route decorators without escaping quotes. An attacker who controls or influences the OpenAPI file can inject Python that runs with the privileges of the app or CI process when the generated module is imported.","severity":"critical","cvss":9.3,"epss":null,"exploited":false,"exploited_at":null,"products":[],"ecosystems":[],"tags":["ci","code-generation","fastapi","package","python"],"not_affected_if":["trusted-specs-only","version-0.8.1-or-later"],"how_to_check":"- Check the installed version with `pip show fastapi-code-generator` or the version pinned in your requirements or lock file.\n- Look for OpenAPI specs from outside parties, or specs fetched at build time, that feed the generator.\n- Inspect generated modules for `@app.get(` decorators whose path argument contains unexpected quotes or code.","fix":"- `fastapi-code-generator` `0.8.1`","status":"open","published_at":"2026-11-03T20:18:15+00:00","first_seen_at":"2026-11-03T20:49:23+00:00","triaged_at":"2026-11-03T20:49:40+00:00","updated_at":"2026-11-03T20:49:40+00:00","category":"package","confidence":0.8,"triage":{"at":"2026-11-03T20:49:40Z","model":"claude-haiku-5-5","output":{"fix":"- `fastapi-code-generator` `0.8.1`","reach":"unknown","title":"fastapi-code-generator: crafted OpenAPI path injects Python code into generated apps","impact":"high","summary":"fastapi-code-generator turns OpenAPI files into FastAPI applications, but before 0.8.1 it pasted OpenAPI path strings into generated route decorators without escaping quotes. An attacker who controls or influences the OpenAPI file can inject Python that runs with the privileges of the app or CI process when the generated module is imported.","audience":"developers","category":"package","nicknames":[],"who_cares":["python","fastapi","ci","code-generation"],"confidence":0.8,"fix_status":"available","needs_auth":"unknown","worst_case":"Attacker code runs with the app or CI process privileges.","analyst_note":"Confirm whether attacker-influenced OpenAPI input is realistic for typical use and read the linked patch and advisory for any workaround before 0.8.1.","how_to_check":"- Check the installed version with `pip show fastapi-code-generator` or the version pinned in your requirements or lock file.\n- Look for OpenAPI specs from outside parties, or specs fetched at build time, that feed the generator.\n- Inspect generated modules for `@app.get(` decorators whose path argument contains unexpected quotes or code.","plain_action":"","needs_analyst":true,"not_affected_if":["version-0.8.1-or-later","trusted-specs-only"],"who_is_affected":"Teams that run fastapi-code-generator to create FastAPI code from OpenAPI files, especially in CI pipelines or where the OpenAPI input comes from untrusted sources. Projects that only generate code from their own trusted specs and do not use versions before 0.8.1 are less exposed. The sources do not describe other sinks being fixed beyond the OpenAPI path issue; the separate docstring and response-key sinks are noted as distinct.","user_interaction":"no","needs_special_setup":"no","severity_if_unknown":"critical"},"cost_usd":0.000785,"input_tokens":4319,"output_tokens":706,"severity_before":"critical"},"analyst_status":null,"analyst_note":null,"search":"'-2026':15A,18A '-63471':16A,19A '0.8.1':39B,93C,204C 'addit':194C 'additional-response-key':193C 'app':13A,71B 'app.get':103C 'applic':36B,87C,159C 'argument':141C 'attack':53B,120C,124C 'attacker-control':119C 'attacker-influenc':123C 'break':144C 'caus':147C 'ci':20B,73B,162C 'close':129C 'code':3A,10A,22B,29B,83C,155C 'code-gener':21B 'control':55B,121C 'craft':5A 'creat':85C 'cve':14A,17A 'decor':48B,105C,140C,174C 'distinct':182C 'docstr':191C 'embed':116C 'escap':50B,115C 'evalu':176C 'execut':156C 'express':137C 'fail':150C 'fastapi':2A,24B,28B,35B,82C,86C 'fastapi-code-gener':1A,27B,81C 'file':33B,60B,90C 'fix':201C 'generat':4A,12A,23B,30B,46B,77B,84C,95C,102C,111C,148C,154C,168C 'import':80B,171C 'influenc':57B,125C 'inject':8A,62B,133C 'input':145C 'insert':96C 'issu':199C 'key':196C 'modul':78B,169C 'openapi':6A,32B,42B,59B,89C,98C,126C,178C 'oper':189C 'operation-summari':188C 'packag':25B 'past':41B 'path':7A,43B,99C,127C,179C 'prior':91C 'privileg':68B,165C 'process':74B,163C 'project':185C 'python':9A,26B,63B,136C 'quot':51B,110C,117C 'respons':195C 'rout':47B,104C,112C 'run':65B 'separ':187C 'singl':109C 'single-quot':108C 'sink':180C,197C 'string':44B,113C,131C 'summari':190C 'syntact':152C 'syntax':143C 'syntax-break':142C 'turn':31B 'valid':135C,153C 'version':203C 'without':49B,114C","nicknames":[],"mitigations":[],"who_affected":"Teams that run fastapi-code-generator to create FastAPI code from OpenAPI files, especially in CI pipelines or where the OpenAPI input comes from untrusted sources. Projects that only generate code from their own trusted specs and do not use versions before 0.8.1 are less exposed. The sources do not describe other sinks being fixed beyond the OpenAPI path issue; the separate docstring and response-key sinks are noted as distinct.","tier":"B","verified":{},"analyst_revisit_at":null,"fix_status":"available","audience":"developers","plain_action":null,"pkeys":[],"ptokens":[],"labels":["ci","codegeneration","critical","fastapi","package","python"],"campaign_type":null,"first_public_at":"2026-07-01T09:45:58+00:00","kev":null,"cvss_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/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X","cvss_by":"security-advisories@github.com","poc_count":0,"sources":[{"source":"nvd","external_id":"CVE-2026-63471","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-63471","severity":null,"published_at":"2026-11-03T20:18:15+00:00","modified_at":"2026-11-03T20:31:38+00:00","first_seen_at":"2026-11-03T20:49:23+00:00","fetched_at":"2026-11-03T20:49:23+00:00","note":null}],"documents":[{"id":60586,"url":"https://github.com/koxudaxi/fastapi-code-generator/commit/49301dbdb82170d7f50877419d994b05cb1fa2bc","title":"Patch: github.com","kind":"other","source":"nvd","publisher":"vendor","text":null,"published_at":null,"relation":"fix","confidence":null,"note":"Patch: github.com"},{"id":60587,"url":"https://github.com/koxudaxi/fastapi-code-generator/commit/b3b9bd66e0b0c4d8c686fda700258104615a1332","title":"Patch: github.com","kind":"other","source":"nvd","publisher":"vendor","text":null,"published_at":null,"relation":"fix","confidence":null,"note":"Patch: github.com"},{"id":60588,"url":"https://github.com/koxudaxi/fastapi-code-generator/releases/tag/0.8.1","title":"Release notes: github.com","kind":"release","source":"nvd","publisher":"vendor","text":null,"published_at":null,"relation":"fix","confidence":null,"note":"Release notes: github.com"},{"id":60597,"url":"https://github.com/koxudaxi/fastapi-code-generator/security/advisories/GHSA-p2mm-64f6-gmpp","title":"Vendor advisory: github.com","kind":"vendor","source":"nvd","publisher":"vendor","text":null,"published_at":"2026-07-01T09:45:58+00:00","relation":"advisory","confidence":null,"note":"Vendor advisory: github.com"}],"notice":"Free to read at a human pace. An API with keys and an MCP server are in preparation; early access: hello@infrastack.ai"}