Quick answers
- Is CVE-2026-54656 exploited in the wild?
- No. Junglewise Threat Intelligence has no report of CVE-2026-54656 being exploited in the wild.
- How severe is CVE-2026-54656?
- High severity, with a CVSS score of 7.8, published 28 July 2026.
- Which products and versions are affected?
- Koxudaxi Datamodel-Code-Generator >= 0.52.1, <= 0.60.1; datamodel-code-generator (PyPI) ECOSYSTEM:introduced=0.52.1,fixed=0.60.2.
- Is there a fix for CVE-2026-54656?
- Yes. datamodel-code-generator (PyPI): upgrade to 0.60.2 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
- How is CVE-2026-54656 attacked?
- It is attacked with local access, in a software library.
- Am I affected by CVE-2026-54656?
- Check whether you run Koxudaxi Datamodel-Code-Generator or datamodel-code-generator (PyPI) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.
How to fix
- datamodel-code-generator (PyPI): upgrade to 0.60.2 or later
pip install "datamodel-code-generator>=0.60.2"
Technical details
A code injection vulnerability exists in datamodel-code-generator versions 0.52.1 through 0.60.1 when using the Pydantic v2 output mode. The tool interpolates validator definitions from the --extra-template-data file into @field_validator decorators without proper escaping or validation. Specifically, the _process_validators function in src/datamodel_code_generator/model/pydantic_v2/base_model.py wraps field names and validator modes in unescaped single quotes. An attacker can use a single quote to break out of the string literal and inject arbitrary Python expressions. These expressions are executed at class-definition time when the generated module is imported. The issue is fixed in version 0.60.2 by implementing strict validation of validator entries and using repr() for rendering.
Affected products
- koxudaxi datamodel-code-generator >= 0.52.1, <= 0.60.1
Identifiers
- CVE-2026-54656
- GHSA-8m8r-38jm-f355
- PYSEC-2026-3559
Timeline
- 2026-06-08: patched: Fixed in version 0.60.2
- 2026-07-28: disclosed: Advisory published via GitHub and NVD