CVE-2026-54655 `datamodel-code-generator` vulnerable to code execution on import via `x-python-type` JSON-Schema extension in datamodel-code-generator
HighCVSS 7.8
EPSS 0.21%
- Published
- Updated
- Exploit status
- No public exploit known
- CISA SSVC
- Proof of concept public · automatable: no · technical impact: total
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.
Upgrade path
2 packages: 1 fixed.
| Package | Affected | Fixed in | Status |
|---|---|---|---|
| pypi datamodel-code-generator(PyPI) | = 0.51.0; = 0.52.0; = 0.52.1; = 0.52.2 +14 more | 0.60.2 | Fixed |
| koxudaxi datamodel-code-generator | = >= 0.51.0, < 0.60.2 | No fix listed | Versions listed |
Affected products
| Product | Affected versions | Fixed in |
|---|---|---|
| pypi datamodel-code-generator(PyPI) | >= 0.51.0, < 0.60.2 | 0.60.2 |
| pypi datamodel-code-generator(PyPI) | = 0.51.0 | No fix listed |
| pypi datamodel-code-generator(PyPI) | = 0.52.0 | No fix listed |
| pypi datamodel-code-generator(PyPI) | = 0.52.1 | No fix listed |
| pypi datamodel-code-generator(PyPI) | = 0.52.2 | No fix listed |
| pypi datamodel-code-generator(PyPI) | = 0.53.0 | No fix listed |
| pypi datamodel-code-generator(PyPI) | = 0.54.0 | No fix listed |
| pypi datamodel-code-generator(PyPI) | = 0.54.1 | No fix listed |
| pypi datamodel-code-generator(PyPI) | = 0.55.0 | No fix listed |
| pypi datamodel-code-generator(PyPI) | = 0.56.0 | No fix listed |
| pypi datamodel-code-generator(PyPI) | = 0.56.1 | No fix listed |
| pypi datamodel-code-generator(PyPI) | = 0.57.0 | No fix listed |
| pypi datamodel-code-generator(PyPI) | = 0.58.0 | No fix listed |
| pypi datamodel-code-generator(PyPI) | = 0.59.0 | No fix listed |
| pypi datamodel-code-generator(PyPI) | = 0.59.1 | No fix listed |
| pypi datamodel-code-generator(PyPI) | = 0.60.0 | No fix listed |
| pypi datamodel-code-generator(PyPI) | = 0.60.1 | No fix listed |
| koxudaxi datamodel-code-generator | = >= 0.51.0, < 0.60.2 | No fix listed |
| pypi datamodel-code-generator(PyPI) | >= 0.51.0, <= 0.60.1 | No fix listed |
References
- https://github.com/koxudaxi/datamodel-code-generator/security/advisories/GHSA-m34r-v34r-rf9q exploit vendor-advisory
- https://github.com/koxudaxi/datamodel-code-generator/commit/2c93c9b712f43391dcfa975a1e4aa0b7c93ccbba patch
- github.com product
- https://github.com/koxudaxi/datamodel-code-generator/releases/tag/0.60.2
- pypi.org product
- github.com vendor-advisory
- nvd.nist.gov vendor-advisory