CVE-2026-54621: CWE-94: Improper Control of Generation of Code ('Code Injection') in koxudaxi datamodel-code-generator
CVE-2026-54621 is a high-severity code injection vulnerability in koxudaxi's datamodel-code-generator prior to version 0.60.1. The vulnerability arises because GraphQL Union description values are rendered into Python comments without neutralizing carriage returns, allowing attacker-controlled schema content to inject executable Python code into generated models. This malicious code executes when the generated models are imported. The issue is fixed in version 0.60.1.
AI Analysis
Technical Summary
The datamodel-code-generator tool generates Python data models from schema definitions. In versions before 0.60.1, the rendering of GraphQL Union description values into Python comments in specific template files does not neutralize carriage returns. This flaw enables an attacker to craft GraphQL schema content that injects Python code into the generated models. When these models are imported, the injected code executes, leading to potential full compromise of confidentiality, integrity, and availability. The vulnerability is tracked as CWE-94 (Improper Control of Generation of Code) and CWE-1336, with a CVSS v3.1 score of 7.8 (high severity).
Potential Impact
Successful exploitation allows an attacker with the ability to supply GraphQL schema content to inject and execute arbitrary Python code within the generated data models. This can lead to complete compromise of the affected system's confidentiality, integrity, and availability. The vulnerability requires local access to the code generation process (AV:L) and user interaction (UI:R) but does not require privileges (PR:N).
Mitigation Recommendations
This vulnerability is fixed in datamodel-code-generator version 0.60.1. Users should upgrade to version 0.60.1 or later to remediate this issue. No other official remediation or temporary fixes are documented. Until upgrading, avoid importing generated models from untrusted GraphQL schemas.
CVE-2026-54621: CWE-94: Improper Control of Generation of Code ('Code Injection') in koxudaxi datamodel-code-generator
Description
CVE-2026-54621 is a high-severity code injection vulnerability in koxudaxi's datamodel-code-generator prior to version 0.60.1. The vulnerability arises because GraphQL Union description values are rendered into Python comments without neutralizing carriage returns, allowing attacker-controlled schema content to inject executable Python code into generated models. This malicious code executes when the generated models are imported. The issue is fixed in version 0.60.1.
CVSS v3.1
Score 7.8high
Affected software
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
The datamodel-code-generator tool generates Python data models from schema definitions. In versions before 0.60.1, the rendering of GraphQL Union description values into Python comments in specific template files does not neutralize carriage returns. This flaw enables an attacker to craft GraphQL schema content that injects Python code into the generated models. When these models are imported, the injected code executes, leading to potential full compromise of confidentiality, integrity, and availability. The vulnerability is tracked as CWE-94 (Improper Control of Generation of Code) and CWE-1336, with a CVSS v3.1 score of 7.8 (high severity).
Potential Impact
Successful exploitation allows an attacker with the ability to supply GraphQL schema content to inject and execute arbitrary Python code within the generated data models. This can lead to complete compromise of the affected system's confidentiality, integrity, and availability. The vulnerability requires local access to the code generation process (AV:L) and user interaction (UI:R) but does not require privileges (PR:N).
Mitigation Recommendations
This vulnerability is fixed in datamodel-code-generator version 0.60.1. Users should upgrade to version 0.60.1 or later to remediate this issue. No other official remediation or temporary fixes are documented. Until upgrading, avoid importing generated models from untrusted GraphQL schemas.
Technical Details
- Data Version
- 5.2
- Assigner Short Name
- GitHub_M
- Date Reserved
- 2026-06-15T20:07:02.184Z
- Cvss Version
- 3.1
- State
- PUBLISHED
Threat ID: 6a6924a99c2644c7f842565e
Added to database: 07/28/2026, 21:52:41 UTC
Last enriched: 08/05/2026, 15:17:42 UTC
Last updated: 09/10/2026, 19:36:54 UTC
Views: 47
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.