CVE-2026-105801: openapi-python-client: Malicious OpenAPI Documents can cause Arbitrary Code Generation
Impact A malicious OpenAPI document processed by any openapi-python-client prior to 0.29.1 can generate arbitrary Python code. When anyone imports the malicious client, that arbitrary Python code will execute.
Patches Versions starting with 0.29.1 have updated with guardrails to prevent arbitrary code generation. Upgrade to this version immediately and audit any code previously generated from untrusted documents.
Workarounds Do not generate clients for documents you don't completely trust. Carefully verify any existing generated code from untrusted documents.
Other sources
openapi-python-client generates Python clients from OpenAPI documents. Prior to 0.29.1, the generator does not safely neutralize malicious OpenAPI document content before rendering string, docstring, and f-string contexts in generated Python. The generated Python client can contain attacker-controlled Python that executes when a user imports the client, affecting the importing environment's integrity and potentially its confidentiality and availability. This issue is fixed in version 0.29.1.
— MITRE
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
pip/openapi-python-clientto a version that resolves this vulnerability.Fixed in 0.29.1 - Upgrade
Upgrade
openapi-python-clientto a version that resolves this vulnerability.Fixed in 0.29.1 - Compensating control
Do not generate clients from OpenAPI documents that are not completely trusted.
- Operational
Carefully verify and audit any existing Python client code generated from untrusted OpenAPI documents before importing or using it.
Event History
Frequently Asked Questions
Which environments are exposed to this issue?
Environments using openapi-python-client versions before 0.29.1 are exposed if they generate a client from a malicious OpenAPI document and later import that generated client. The code executes in the environment that imports the client.
What must happen for exploitation to succeed?
A malicious OpenAPI document must be processed by the vulnerable generator. Its attacker-controlled content can be rendered into Python string, docstring, or f-string contexts, and execution occurs when the resulting client is imported.
What should be done if clients were previously generated from untrusted documents?
Upgrade openapi-python-client to version 0.29.1 or later immediately. Carefully audit generated code originating from untrusted documents before importing or using it.
What mitigation is available before upgrading?
Do not generate clients from OpenAPI documents unless they are completely trusted. Existing generated clients from untrusted sources should be carefully verified.