PT-2026-65606 · Pypi · Datamodel-Code-Generator

CVE-2026-54654

·

Published

2026-07-28

·

Updated

2026-07-28

CVSS v3.1

7.8

High

VectorAV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
Name of the Vulnerable Software and Affected Versions datamodel-code-generator versions 0.14.1 through 0.60.1
Description Code injection is possible when the --extra-template-data file contains a comment value with a carriage return (r). The software renders this comment variable into Python comments within several templates without neutralizing line terminators. Because the Python tokenizer treats a carriage return as a physical-line terminator, the comment is prematurely ended, allowing subsequent text to be parsed and executed as Python code when the generated models are imported. This can lead to arbitrary code execution in the process of the importer.
Recommendations Upgrade datamodel-code-generator to version 0.60.2 or later. As a temporary mitigation, avoid using the --extra-template-data flag or ensure that the comment values in the extras file do not contain carriage returns (r), vertical tabs (x0b), or form feeds (x0c).

Fix

Code Injection

Found an issue in the description? Have something to add? Feel free to write us 👾

Weakness Enumeration

Related Identifiers

CVE-2026-54654
GHSA-WJV6-JCFJ-MF9R

Affected Products

Datamodel-Code-Generator