CVE-2026-54656 json
`datamodel-code-generator` vulnerable to code execution on import via unescaped `validators` entries in --extra-template-data
published 2026-07-28 3 mo ago modified 2026-10-23 16 d ago also GHSA-8m8r-38jm-f355 , PYSEC-2026-3559 , EUVD-2026-50075
- cvss
- 7.8
- version 3.1, CNA
- cisa kev
- Not listed
- not in CISA's catalog
- epss
- 0.3%
- EPSS 0.3% chance of exploitation in 30 days, percentile 16%
- public exploits
- 0
- none known
Summary
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.
Patch / fix
- pypi datamodel-code-generator 0.60.2
- koxudaxi datamodel-code-generator 0.60.2
CISA SSVC
- Exploitation
- Proof of concept is public
- Automatable
- no
- Technical impact
- total
- Assessed
- 3 mo ago
Exploit prediction
0.25% chance of exploitation in the next 30 days, higher than 16% of all scored CVEs (FIRST EPSS, 2026-11-08).
Exploits and checks
- github.com https://github.com/koxudaxi/datamodel-code-generator/security/advisories/GHSA-8m8r-38jm-f355 referenced PoC, tagged "exploit" by a source, unverified
CVSS scores
| assigned by | version | score | vector |
|---|---|---|---|
| CNA | 3.1 | 7.8 | CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H |
| OSV | 3.1 | 7.8 | CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H |
| GitHub | 3.1 | 7.8 | CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H |
Affected packages
| ecosystem | package | affected | fixed in |
|---|---|---|---|
| pypi | datamodel-code-generator | >=0.52.1, <0.60.2 |
0.60.2 |
Affected products
- koxudaxi datamodel-code-generator
Classification
- Weakness
-
- CWE-94 Improper Control of Generation of Code
References
-
github.com
/koxudaxi/datamodel-code-generator/commit/a43d02906111a2fdcaf13ee5b62eb2da85376f19
web, patch
-
github.com
/koxudaxi/datamodel-code-generator/security/advisories/GHSA-8m8r-38jm-f355
exploit, web, vendor-advisory
-
github.com
/koxudaxi/datamodel-code-generator/releases/tag/0.60.2
web, release-notes
-
github.com
/koxudaxi/datamodel-code-generator
package
-
pypi.org
/project/datamodel-code-generator
package
-
github.com
/advisories/GHSA-8m8r-38jm-f355
advisory
-
nvd.nist.gov
/vuln/detail/CVE-2026-54656
advisory
Sources
- CVE List CVE-2026-54656
- GitHub Advisory GHSA-8m8r-38jm-f355
- NVD CVE-2026-54656
- OSV PYSEC-2026-3559
Fencer Vulns keeps one entry per vulnerability: the CVE id wins, then GHSA, and records that alias each other are merged, except that two CVEs always keep separate entries. The same data is available as JSON.