


Perceptive Security
SOC/SIEM Consultancy

datamodel-code-generator generates Pydantic v2 models, dataclasses, TypedDict, and msgspec.Struct from OpenAPI, JSON Schema, GraphQL, Avro, Protobuf, and raw JS…
Published:
27 July 2026 at 22:00:00
Alert date:
28 July 2026 at 23:04:30
Source:
nvd.nist.gov
Supply Chain & Dependencies, Web Technologies
CVE-2026-54656 affects datamodel-code-generator versions 0.52.1 through 0.60.2, a tool that generates Pydantic v2 models and other data structures from various schema formats. The vulnerability exists in src/datamodel_code_generator/model/pydantic_v2/base_model.py where the _process_validators function interpolates user-supplied validators from the --extra-template-data argument into @field_validator decorators without safe validation. This allows an attacker to inject arbitrary Python code into generated model files. The malicious code executes when the generated Pydantic v2 model is imported into a Python application. This is a code injection vulnerability in a developer toolchain component, posing a supply chain risk. The issue has been fixed in version 0.60.2 of datamodel-code-generator. Developers using affected versions should upgrade immediately to mitigate the risk.
Technical details
Mitigation steps:
Affected products:
datamodel-code-generator 0.52.1 - 0.60.1
Related links:
https://nvd.nist.gov/vuln/detail/CVE-2026-54656
https://github.com/koxudaxi/datamodel-code-generator/commit/a43d02906111a2fdcaf13ee5b62eb2da85376f19
https://github.com/koxudaxi/datamodel-code-generator/releases/tag/0.60.2
https://github.com/koxudaxi/datamodel-code-generator/security/advisories/GHSA-8m8r-38jm-f355
Related CVE's:
Related threat actors:
IOC's:
This article was created with the assistance of AI technology by Perceptive.
