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

CVE-2026-54655

·

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.51.0 through 0.60.1
Description Insufficient validation of x-python-type values in the get python type override() function within src/datamodel code generator/parser/jsonschema.py allows attacker-controlled JSON Schema content to execute arbitrary Python code. When a schema author uses the x-python-type extension to override a generated Python type, the value is inserted into the generated field annotations without adequate sanitization. An attacker can bypass the existing sanitization by placing a bracket [ early in the string, allowing them to embed arbitrary Python statements. This code is executed at class-definition time the moment the generated module is imported by a developer or a CI runner.
Recommendations Upgrade datamodel-code-generator to version 0.60.2 or later.

Fix

Code Injection

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

Weakness Enumeration

Related Identifiers

CVE-2026-54655
GHSA-M34R-V34R-RF9Q

Affected Products

Datamodel-Code-Generator