Read the docs
TI-2026-39452 Aliases CVE-2026-54621GHSA-j884-q54q-mmx3

`datamodel-code-generator` vulnerable to code injection via unescaped carriage return in GraphQL Union description

Priority LOW 35CWE-1336Published · Updated

Key facts

Attack vector
Local
Privileges required
None
User interaction
Required
Attack complexity
Low
Impact type
Code execution
Confidentiality · integrity · availability
High · High · High
Fix status
Fixed

Attack profile from CVSS 3.1 · CNA. Fix status from CNA and GitHub. Impact type from CWE-1336.

Summary

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.

Why it matters now

Exploitation None reported CISA SSVC · not in CISA KEV
EPSS 0.0021 11th percentileScored 2026-11-07
Fix Fixed datamodel-code-generator (koxudaxi): 0.60.1datamodel-code-generator (PyPI): 0.60.1

SSVC decision points

CISA ADP · SSVC 2.0.3

Exploitation
None
Automatable
No
Technical impact
Total

The decision (Track, Attend, Act) also depends on your mission and well-being impact; see CISA's SSVC guide.

Affected products

VendorProductAffected versionsFixed inStatusSource
koxudaxidatamodel-code-generator0.25.0 to before 0.60.10.60.1Patch availableCNA
—datamodel-code-generator (PyPI)0.25.0 to before 0.60.10.60.1Patch availableGHSA-j884-q54q-mmx3
  • datamodel-code-generator Vendorkoxudaxi Affected 0.25.0 to before 0.60.1 Fixed in 0.60.1 Patch available CNA
  • datamodel-code-generator (PyPI) Vendor— Affected 0.25.0 to before 0.60.1 Fixed in 0.60.1 Patch available GHSA-j884-q54q-mmx3

CPE names Threatist (inferred) · 1

Inferred from how NVD named this product before; not given by a source.

CPEVersionsRoleVendor
cpe:2.3:a:koxudaxi:datamodel-code-generator:*:*:*:*:*:*:*:*——koxudaxi
  • cpe:2.3:a:koxudaxi:datamodel-code-generator:*:*:*:*:*:*:*:* Versions — — ·koxudaxi

Remediation

  • Fix · CNA datamodel-code-generator (koxudaxi) Fixed in 0.60.1
  • Fix · GHSA-j884-q54q-mmx3 datamodel-code-generator (PyPI) Fixed in 0.60.1 Advisory →

Timeline

  1. 2026-10-02 Threatist record created from CVE-2026-54621
  2. 2026-10-03 Alias added: GHSA-j884-q54q-mmx3

References

  • TI-2026-84481 Code injection in fastapi-code-generator via OpenAPI route paths CVSS 4.0CRITICAL 9.3
  • TI-2026-84480 Code injection in fastapi-code-generator route docstrings CVSS 4.0CRITICAL 9.3
  • TI-2026-39961 Arbitrary local file read via XSD `schemaLocation` (`xs:include`/`xs:import`) path traversal, with no remote-ref gate CVSS 3.1HIGH 7.5
  • TI-2026-39960 Information disclosure in koxudaxi datamodel-code-generator CVSS 3.1HIGH 7.5
  • TI-2026-39512 datamodel-code-generator vulnerable to SSRF via --url: no host/IP validation, follows redirects CVSS 3.1HIGH 8.2
  • TI-2026-39511 datamodel-code-generator vulnerable to SSRF via JSON-Schema `$ref` to HTTP URL (silent by default) CVSS 3.1HIGH 8.2
See all 15 →

Sources