CVE-2026-105801
Unsafe rendering of malicious OpenAPI content leads to code execution on import.
- CVSS 8.4
- CWE-94
- Input Validation and Sanitization
- Remote
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.
- CWE
- CWE-94
- CVSS base score
- 8.4
- Published
- 2026-10-06
- OWASP
- A03 Injection
- Orthogonal defect classification
- Build/Package/Merge
- Code defect classification
- Missing Check
- Category
- Input Validation and Sanitization
- Subcategory
- Insecure Parsing or Deserialization
- Accessibility scope
- Remote
- Impact
- Arbitrary Code Execution
- Affected component
- openapi-python-client
- Fixed by upgrading
- Yes
Solution
Upgrade openapi‑python‑client to v0.29.1 or later.
Vulnerable code sample
import os
def render_client(module_name: str, docstring: str) -> str:
# VULNERABLE: unsanitized docstring injected into f-string
client_code = f'''"""
{docstring}
"""
class {module_name.title()}Client:
def __init__(self, base_url: str):
self.base_url = base_url
'''
return client_code
def write_client_file(path: str, module_name: str, docstring: str):
code = render_client(module_name, docstring)
with open(path, 'w', encoding='utf-8') as f:
f.write(code)Patched code sample
import os
def render_client(module_name: str, docstring: str) -> str:
# FIX: escape braces to prevent f-string injection
safe_doc = docstring.replace('{', '{{').replace('}', '}}')
client_code = f'''"""
{safe_doc}
"""
class {module_name.title()}Client:
def __init__(self, base_url: str):
self.base_url = base_url
'''
return client_code
def write_client_file(path: str, module_name: str, docstring: str):
code = render_client(module_name, docstring)
with open(path, 'w', encoding='utf-8') as f:
f.write(code)Cite this entry
@misc{vaitp:cve2026105801,
title = {{Unsafe rendering of malicious OpenAPI content leads to code execution on import.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2026-105801},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-105801/}}
}
Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.
The supreme art of war is to subdue the enemy without fighting.
Sun Tzu – “The Art of War”
:: Shaping the future through research and ingenuity ::
