CVE-2026-55415: CWE-94: Improper Control of Generation of Code ('Code Injection') in koxudaxi datamodel-code-generator
datamodel-code-generator generates Pydantic v2 models, dataclasses, TypedDict, and msgspec.Struct from OpenAPI, JSON Schema, GraphQL, Avro, Protobuf, and raw JSON, YAML, or CSV. From 0.11.6 until 0.64.0, datamodel-code-generator allows attacker-controlled x-python-import or customTypePath schema extensions to reach src/datamodel_code_generator/parser/jsonschema.py and generated import handling through Import.from_full_path and Imports.create_line in src/datamodel_code_generator/imports.py, allowing a newline to break out of an import statement and execute Python code when the generated model is imported. This issue is fixed in version 0.64.0.
AI Analysis
Technical Summary
The datamodel-code-generator tool, used to generate Pydantic v2 models and other data structures from various schema formats, improperly controls code generation when processing x-python-import or customTypePath schema extensions. Specifically, from versions 0.11.6 until 0.64.0, these extensions can inject newline characters that break out of import statements in the generated Python code, enabling execution of arbitrary code upon import. This is a CWE-94 (Improper Control of Generation of Code) vulnerability that can lead to high impact including confidentiality, integrity, and availability compromise. The issue is resolved in version 0.64.0.
Potential Impact
Successful exploitation allows an attacker to execute arbitrary Python code in the context of the environment importing the generated model, potentially leading to full system compromise. The vulnerability affects confidentiality, integrity, and availability of the affected system. The CVSS v3.1 score is 7.5 (High), reflecting network attack vector, high impact, but requiring user interaction and high attack complexity.
Mitigation Recommendations
Upgrade datamodel-code-generator to version 0.64.0 or later, where this vulnerability is fixed. No other official remediation or temporary fixes are documented. Until upgrading, avoid importing generated models from untrusted schema sources that could contain malicious x-python-import or customTypePath extensions.
CVE-2026-55415: CWE-94: Improper Control of Generation of Code ('Code Injection') in koxudaxi datamodel-code-generator
Description
datamodel-code-generator generates Pydantic v2 models, dataclasses, TypedDict, and msgspec.Struct from OpenAPI, JSON Schema, GraphQL, Avro, Protobuf, and raw JSON, YAML, or CSV. From 0.11.6 until 0.64.0, datamodel-code-generator allows attacker-controlled x-python-import or customTypePath schema extensions to reach src/datamodel_code_generator/parser/jsonschema.py and generated import handling through Import.from_full_path and Imports.create_line in src/datamodel_code_generator/imports.py, allowing a newline to break out of an import statement and execute Python code when the generated model is imported. This issue is fixed in version 0.64.0.
CVSS v3.1
Score 7.5high
Affected software
koxudaxi
datamodel-code-generator
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
The datamodel-code-generator tool, used to generate Pydantic v2 models and other data structures from various schema formats, improperly controls code generation when processing x-python-import or customTypePath schema extensions. Specifically, from versions 0.11.6 until 0.64.0, these extensions can inject newline characters that break out of import statements in the generated Python code, enabling execution of arbitrary code upon import. This is a CWE-94 (Improper Control of Generation of Code) vulnerability that can lead to high impact including confidentiality, integrity, and availability compromise. The issue is resolved in version 0.64.0.
Potential Impact
Successful exploitation allows an attacker to execute arbitrary Python code in the context of the environment importing the generated model, potentially leading to full system compromise. The vulnerability affects confidentiality, integrity, and availability of the affected system. The CVSS v3.1 score is 7.5 (High), reflecting network attack vector, high impact, but requiring user interaction and high attack complexity.
Mitigation Recommendations
Upgrade datamodel-code-generator to version 0.64.0 or later, where this vulnerability is fixed. No other official remediation or temporary fixes are documented. Until upgrading, avoid importing generated models from untrusted schema sources that could contain malicious x-python-import or customTypePath extensions.
Technical Details
- Data Version
- 5.2
- Assigner Short Name
- GitHub_M
- Date Reserved
- 2026-06-16T21:48:43.125Z
- Cvss Version
- 3.1
- State
- PUBLISHED
Threat ID: 6a6924a99c2644c7f842568b
Added to database: 07/28/2026, 21:52:41 UTC
Last enriched: 07/29/2026, 23:36:59 UTC
Last updated: 09/10/2026, 20:00:53 UTC
Views: 81
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.