CVE-2026-54653

Description

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.17.0 until 0.60.2, datamodel-code-generator preserves attacker-controlled default_factory values in src/datamodel_code_generator/parser/jsonschema.py through JsonSchemaObject.init and get_field_extras and emits them into Field(default_factory=...) or field(default_factory=...), allowing Python expression execution when the generated model is imported. This issue is fixed in version 0.60.2.

Severity
HIGH
CVSS v3
8.8
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H · source cna
Exploit chance (EPSS)
0.711%
chance of exploitation in the next 30 days
higher than 54.2% of scored CVEs · 2026-11-17
CISA KEV
Not listed
Public exploit code
Yes
Exploit references (NVD and CNA): 1
Metasploit modules: 0
Nuclei templates: 0

Weakness

CISA SSVC decision points

Exploitationnone
Automatableno
Technical impacttotal
Scored2026-07-29

Timeline

  1. 2026-07-28Published by the CNA21:48 UTC
  2. 2026-07-28GitHub advisory published (GHSA-386q-5hp3-95m9)same day
  3. 2026-07-29CISA SSVC decision recorded1 day after publication

The timeline shows what already happened. To be told when this CVE changes next, watch it from the API.

Exploit and advisory records

GitHub advisory GHSA-386q-5hp3-95m9, affected packages:

PackageVulnerable versionsFixed in
PyPI datamodel-code-generatorfrom 0.17.0 before 0.60.20.60.2

Affected products

Products listed as vulnerable. Upgrade to the version under "Fixed in", or a later one.

ProductVulnerable versionsFixed in
koxudaxi datamodel-code-generatorfrom 0.17.0 before 0.60.2fixed in 0.60.20.60.2

Products and versions as NVD and the vendor that published the CVE list them.

References

Get more CVE data from the API.

Free without a key or signup. Pro adds monitoring and higher limits: pricing.

Sources