top of page
perceptive_background_267k.jpg

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

Click to open the original link from this advisory

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:

Related CVE's:

Related threat actors:

IOC's:

This article was created with the assistance of AI technology by Perceptive.

© 2025 by Perceptive Security. All rights reserved.

email: info@perceptivesecurity.com

Deze website toont informatie afkomstig van externe bronnen; Perceptive aanvaardt geen verantwoordelijkheid voor de juistheid, volledigheid of actualiteit van deze informatie.

bottom of page