CVE-2026-54621
published high CVSS 3.1 · 7.8`datamodel-code-generator` vulnerable to code injection via unescaped carriage return in GraphQL Union description
Package status and fixes
| Distro / vendor | Release | Package / product | Publisher status | Fixed build | Source |
|---|---|---|---|---|---|
| koxudaxi | — | datamodel-code-generator>= 0.25.0, < 0.60.1 | Affected | Not stated | GitHub_M |
Description
datamodel-code-generator generates Python data models from schema definitions. Prior to 0.60.1, GraphQL Union description values in src/datamodel_code_generator/model/template/UnionTypeStatement.jinja2 and src/datamodel_code_generator/model/template/UnionTypeStatement.py312.jinja2 are rendered into Python comments without neutralizing carriage returns in Python # comments, allowing attacker-controlled GraphQL schema content to inject Python code into generated models that runs when imported. This issue is fixed in version 0.60.1.
Related advisories
Vendor advisories explicitly linked to this CVE.
No linked advisories were found for this CVE.
Assessment
CVSS risk assessment and additional context for this vulnerability.
- CVSS version
- 3.1
- Base score
- 7.8 / 10
- Severity
- high
- Provider
- GitHub_M · cna
- Vector string
- CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
Publisher product statements
Version ranges and default statuses as reported by each provider.
| Vendor | Product | Version status | Source |
|---|---|---|---|
| koxudaxi | datamodel-code-generator | >= 0.25.0, < 0.60.1 (affected) | GitHub_M · cna |
Weaknesses
2- CWE-94 CWE-94: Improper Control of Generation of Code ('Code Injection')
- CWE-1336 CWE-1336: Improper Neutralization of Special Elements Used in a Template Engine
References
3Provider assertions
2GitHub_M · cna
`datamodel-code-generator` vulnerable to code injection via unescaped carriage return in GraphQL Union description
CISA-ADP · adp
CISA ADP Vulnrichment
Provenance
- Schema
- 5.2
- Searchable
- yes
- Content hash
- c527c35087f8e8c6855607e0ff77254a5bf9a34a075e76fc753f5f9c177861f9
- Ingested
- 23 Sep 2026, 09:20:39 UTC
- Source record
- Official CVE record