Vulnerability · Published Jul 28, 2026 · Assigned by GitHub_M

CVE-2026-54655`datamodel-code-generator` vulnerable to code execution on import via `x-python-type` JSON-Schema extension in datamodel-code-generator

High 7.8

In plain English

A high-severity code injection in datamodel-code-generator from koxudaxi. Proof-of-concept exploit code is public. The chance it is exploited in the next 30 days is estimated at 0.2% (higher than 11% of all known vulnerabilities). Fixed versions are available - upgrade the affected package.

Severity (CVSS 3.1)7.8High
Exploit odds (30 days)0.2%top 88.7% of all CVEs
Exploited in the wildNo reportsCISA SSVC: poc
Attack toolingNoneno public tooling known

Official description

datamodel-code-generator generates Python data models from schema definitions. From 0.51.0 until 0.60.2, x-python-type values parsed by src/datamodel_code_generator/parser/jsonschema.py in _get_python_type_override are inserted into generated field annotations without sufficient validation, allowing attacker-controlled JSON Schema content to execute Python code when the generated module is imported. This issue is fixed in version 0.60.2.

Affected packages & fixed versions

EcosystemPackageFixed inAdvisory
PyPIdatamodel-code-generator0.60.2GHSA-m34r-v34r-rf9q
PyPIdatamodel-code-generator0.60.2PYSEC-2026-3562

Affected products (as reported)

VendorProductVersions
koxudaxi datamodel-code-generator >= 0.51.0, < 0.60.2

Weakness: CWE-94 · Vector: CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H

References