Koxudaxi datamodel-code-generator
`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.
Affected versions and mitigation
From the CVE record and the vendor's references.Affected
- >= 0.25.0, < 0.60.1
Fixed in 0.60.1
Mitigation
Upgrade datamodel-code-generator to 0.60.1 or later.
References
- Vendor advisory github.com/koxudaxi/datamodel-code-generator/s…
- Patch github.com/koxudaxi/datamodel-code-generator/c…
- Release notes github.com/koxudaxi/datamodel-code-generator/r…
Timeline
Days relative to CVE publicationNo public PoC found yet; not in CISA KEV.
PoC repositories
Found on GitHub.No PoC repositories found yet.