CVE-2026-54656CWE-94code-injection

CVE-2026-54656

High · published July 29, 2026

CVSS v3.1
7.8
EPSS
0%
Percentile
15.8
In the wild
Unconfirmed
What it is

datamodel-code-generator generates Pydantic v2 models, dataclasses, TypedDict, and msgspec.Struct from OpenAPI, JSON Schema, GraphQL, Avro, Protobuf, and raw JSON, YAML, or CSV. From 0.52.1 until 0.60.2, datamodel-code-generator interpolates validators from --extra-template-data in src/datamodel_code_generator/model/pydantic_v2/base_model.py through _process_validators into @field_validator decorators without safe validation, allowing Python code execution when the generated Pydantic v2 model is imported. This issue is fixed in version 0.60.2.

The record
Technical detail
CVSS v3.1
7.8 · HIGH
Vector
CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
CVSS v4.0
Not supplied
EPSS
0.00252 · 15.8th percentile
Weakness
CWE-94 · Improper Control of Generation of Code ('Code Injection')
Published
2026-07-29T02:17Z
Affected products (1)
ProductVersionsFixed in
koxudaxi/datamodel-code-generator≥ 0.52.1, < 0.60.20.60.2
References (4)
EPSS history
Timeline
  • 28 JUL 21:43Z
    `datamodel-code-generator` vulnerable to code execution on import via unescaped `validators` entries in --extra-template-data
    cvelistv5