


Perceptive Security
SOC/SIEM Consultancy

datamodel-code-generator generates Python data models from schema definitions. From 0.14.1 until 0.60.2, the --extra-template-data comment field is rendered int…
Published:
27 juli 2026 om 22:00:00
Alert date:
28 juli 2026 om 23:04:30
Source:
nvd.nist.gov
Supply Chain & Dependencies, Web Technologies
A code injection vulnerability exists in datamodel-code-generator versions 0.14.1 through 0.60.2. The --extra-template-data comment field is rendered into Python comments across multiple Jinja2 templates without neutralizing carriage returns. This allows an attacker-controlled comment value to break out of Python comments and inject arbitrary Python code into generated data models. The injected code executes automatically when the generated model files are imported. Affected templates include TypeAliasAnnotation, TypedDict, dataclass, msgspec.Struct, and both pydantic v1 and v2 BaseModel templates. The vulnerability poses a significant supply chain risk as generated code may be distributed and imported by downstream users. The issue has been patched in version 0.60.2 with proper carriage return neutralization. Users are strongly advised to upgrade and regenerate any previously generated model files.
Technical details
Mitigation steps:
Affected products:
datamodel-code-generator
Related links:
https://nvd.nist.gov/vuln/detail/CVE-2026-54654
https://github.com/koxudaxi/datamodel-code-generator/commit/b73abb5cd703a50471b8950bbd3bd0b82ad71de7
https://github.com/koxudaxi/datamodel-code-generator/releases/tag/0.60.2
https://github.com/koxudaxi/datamodel-code-generator/security/advisories/GHSA-wjv6-jcfj-mf9r
Related CVE's:
Related threat actors:
IOC's:
This article was created with the assistance of AI technology by Perceptive.
