CVE-2026-54654: CWE-94: Improper Control of Generation of Code ('Code Injection') in koxudaxi datamodel-code-generator
CVE-2026-54654 is a high-severity code injection vulnerability in koxudaxi's datamodel-code-generator affecting versions from 0.14.1 up to but not including 0.60.2. The issue arises because the --extra-template-data comment field is rendered into Python comments without neutralizing carriage returns, allowing attacker-controlled input to inject and execute arbitrary Python code when the generated models are imported. This vulnerability is fixed in version 0.60.2.
AI Analysis
Technical Summary
The datamodel-code-generator tool generates Python data models from schema definitions. Between versions 0.14.1 and 0.60.2, the --extra-template-data comment field is incorporated into Python comments in multiple Jinja2 template files without sanitizing carriage returns. This improper handling allows an attacker to inject Python code into the generated models, which executes upon import. The vulnerability is classified as CWE-94 (Improper Control of Generation of Code) and CWE-1336, and it has a CVSS 3.1 score of 7.8, indicating high severity. The issue is resolved in version 0.60.2.
Potential Impact
An attacker able to control the --extra-template-data comment field can inject arbitrary Python code into the generated data model files. This code executes when the generated models are imported, potentially leading to full compromise of the environment running the code. The vulnerability affects confidentiality, integrity, and availability, as indicated by the CVSS vector (C:H/I:H/A:H).
Mitigation Recommendations
Upgrade datamodel-code-generator to version 0.60.2 or later, where this code injection vulnerability is fixed. No other mitigations are documented. Patch status is confirmed fixed in 0.60.2.
CVE-2026-54654: CWE-94: Improper Control of Generation of Code ('Code Injection') in koxudaxi datamodel-code-generator
Description
CVE-2026-54654 is a high-severity code injection vulnerability in koxudaxi's datamodel-code-generator affecting versions from 0.14.1 up to but not including 0.60.2. The issue arises because the --extra-template-data comment field is rendered into Python comments without neutralizing carriage returns, allowing attacker-controlled input to inject and execute arbitrary Python code when the generated models are imported. This vulnerability is fixed in version 0.60.2.
CVSS v3.1
Score 7.8high
Affected software
koxudaxi
datamodel-code-generator
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
The datamodel-code-generator tool generates Python data models from schema definitions. Between versions 0.14.1 and 0.60.2, the --extra-template-data comment field is incorporated into Python comments in multiple Jinja2 template files without sanitizing carriage returns. This improper handling allows an attacker to inject Python code into the generated models, which executes upon import. The vulnerability is classified as CWE-94 (Improper Control of Generation of Code) and CWE-1336, and it has a CVSS 3.1 score of 7.8, indicating high severity. The issue is resolved in version 0.60.2.
Potential Impact
An attacker able to control the --extra-template-data comment field can inject arbitrary Python code into the generated data model files. This code executes when the generated models are imported, potentially leading to full compromise of the environment running the code. The vulnerability affects confidentiality, integrity, and availability, as indicated by the CVSS vector (C:H/I:H/A:H).
Mitigation Recommendations
Upgrade datamodel-code-generator to version 0.60.2 or later, where this code injection vulnerability is fixed. No other mitigations are documented. Patch status is confirmed fixed in 0.60.2.
Technical Details
- Data Version
- 5.2
- Assigner Short Name
- GitHub_M
- Date Reserved
- 2026-06-15T20:16:46.199Z
- Cvss Version
- 3.1
- State
- PUBLISHED
Threat ID: 6a6921519c2644c7f83dbfa5
Added to database: 07/28/2026, 21:38:25 UTC
Last enriched: 08/05/2026, 14:54:46 UTC
Last updated: 09/12/2026, 22:01:34 UTC
Views: 78
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.