CVE-2026-54655
CVE-2026-54655 · `datamodel-code-generator` vulnerable to code execution on import via `x-python-type` JSON-Schema extension in datamodel-code-generator
This page contains facts from public vulnerability sources. Check the original advisory before updating.
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.
CVSS 7.8 · High · EPSS 0.2% · Fix available
- Published
- Updated
Stack: python
Affected products and versions
datamodel-code-generator
- Versions
- >= 0.51.0, < 0.60.2: Affected
No fix published
datamodel-code-generator PyPI
- Versions
- 0.51.0
- 0.52.0
- 0.52.1
- 0.52.2
- 0.53.0
- 0.54.0
- 0.54.1
- 0.55.0
- 0.56.0
- 0.56.1
- 0.57.0
- 0.58.0
- 0.59.0
- 0.59.1
- 0.60.0
- 0.60.1
- Affected ranges
- ECOSYSTEM: ≥ 0.51.0, < 0.60.2
Update to 0.60.2
Original sources
- https://github.com/koxudaxi/datamodel-code-generator/security/advisories/GHSA-m34r-v34r-rf9q
- https://github.com/koxudaxi/datamodel-code-generator/commit/2c93c9b712f43391dcfa975a1e4aa0b7c93ccbba
- https://github.com/koxudaxi/datamodel-code-generator/releases/tag/0.60.2
- https://nvd.nist.gov/vuln/detail/CVE-2026-54655