Code Injection Vulnerability in datamodel-code-generator by Koxudaxi
CVE-2026-54654
7.8HIGH
What is CVE-2026-54654?
The datamodel-code-generator tool, which converts schema definitions into Python data models, contains a vulnerability affecting versions 0.14.1 to 0.60.2. The issue arises from the --extra-template-data comment field being rendered into Python comments without properly neutralizing carriage returns. This flaw can be exploited by an attacker who controls the input comment value, leading to potential execution of arbitrary Python code within the generated models upon import. The vulnerability has been addressed in version 0.60.2.
Affected Version(s)
datamodel-code-generator >= 0.14.1, < 0.60.2
