CVE-2026-54621
HIGH 7.8CVSS 3.1`datamodel-code-generator` vulnerable to code injection via unescaped carriage return in GraphQL Union 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.
- Published
- 28 Jul 2026
- Last modified
- 23 Oct 2026
- Assigned by
- security-advisories@github.com
- NVD status
- Deferred
- Weakness
- CWE-1336CWE-94
- Also known as
- GHSA-j884-q54q-mmx3PYSEC-2026-3561
- Sources
- NVDJSONOSV GHSA-j884-q54q-mmx3JSONOSV PYSEC-2026-3561JSON
Scores
| Source | Scored by | Version | Score | Vector / decision |
|---|---|---|---|---|
| NVD | security-advisories@github.com (Secondary) | CVSS 3.1 | HIGH 7.8 | CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H |
| OSV | GitHub | CVSS 3.1 | HIGH 7.8 | CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H |
| OSV | PyPA | CVSS 3.1 | HIGH 7.8 | CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H |
Affected
| Source | Vendor / ecosystem | Product / package | Affected versions | Fixed in |
|---|---|---|---|---|
| OSV | PyPI | datamodel-code-generator | >= 0.25.0, < 0.60.1 | 0.60.1 |
References
- https://github.com/koxudaxi/datamodel-code-generator/commit/aec47bc414779f4a9992b3919c8f7663afd6c988
- https://github.com/koxudaxi/datamodel-code-generator/releases/tag/0.60.1 · WEB
- https://github.com/koxudaxi/datamodel-code-generator/security/advisories/GHSA-j884-q54q-mmx3 · WEB
- https://github.com/koxudaxi/datamodel-code-generator · PACKAGE
- https://pypi.org/project/datamodel-code-generator · PACKAGE
- https://github.com/advisories/GHSA-j884-q54q-mmx3 · ADVISORY
- https://nvd.nist.gov/vuln/detail/CVE-2026-54621 · ADVISORY
History
- 25 Nov 2026 21:04 UTC · NVD: first stored (published 28 Jul 2026)
- 25 Nov 2026 20:12 UTC · OSV: first stored (published 4 Aug 2026)
- 25 Nov 2026 20:11 UTC · OSV: first stored (published 28 Jul 2026)