Skip to content
Noroxi
CVE-2026-54653· NVD / CVE Program· CNA GitHub_M

`datamodel-code-generator` vulnerable to code injection in via attacker-controlled `default_factory` schema field

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.

HighCVSS 8.8 · v3.1—No exploit Fix available
Published
Jul 28, 2026
Updated
Aug 6, 2026
EPSS
0.7% · 52th percentile
Follow this CVE

Sign in to follow · You’ll be notified if a followed record enters KEV, gets an exploit or is updated.

Report tools

JSON

Action score

35

Monitor

Low priority for now.

CVSS
35 / 40 · 8.8 / 10
CISA KEV
0 / 30 · Not listed
EPSS
0 / 30 · 0.7%

CISA SSVC decision

Exploitation
none
Automatable
no
Technical impact
total

Vulnrichment: CISA's decision-tree inputs.

CNA vs NVD score

NVD
—
CNA · GitHub_M
8.8
NVD has not scored this yet; the score shown is the CNA’s.

The score given by the assigning authority versus NVD’s independent score. A gap means the severity is contested.

Noroxi analysis

No Noroxi analysis for this record yet

We don't hand-write analysis for the hundreds of thousands of vulnerabilities in the database; that wouldn't be honest. For notable, high-impact vulnerabilities our team writes the mechanism, detection and remediation steps.

We use this product, ask for help

Affected systems

VendorProduct
koxudaxidatamodel-code-generator

Affected versions

NVD version ranges (for catalog products). Add the product to your stack with a version and matching uses these.

  • koxudaxi datamodel-code-generator0.17.0 and later · before 0.60.2

Versions reported by the vendor

Affected version ranges reported by the assigning authority (GitHub_M). Independent of NVD's CPE analysis and usually ahead of it.

  • koxudaxi datamodel-code-generator

    • >= 0.17.0, < 0.60.2affected

Package-level exposure

OSV and GitHub Advisory data: ecosystem, package and range. SBOM matching uses this table.

EcosystemPackageAffected rangeFix
PyPIdatamodel-code-generatorfrom 0.17.0 · before 0.60.20.60.2

Other highest-scoring records for the same primary product.

  • CVE-2026-54691datamodel-code-generator vulnerable to SSRF via --url: no host/IP validation, follows redirects
    32Monitor
  • CVE-2026-54690datamodel-code-generator vulnerable to SSRF via JSON-Schema `$ref` to HTTP URL (silent by default)
    32Monitor
  • CVE-2026-54656`datamodel-code-generator` vulnerable to code execution on import via unescaped `validators` entries in --extra-template-data
    31Monitor
  • CVE-2026-54655`datamodel-code-generator` vulnerable to code execution on import via `x-python-type` JSON-Schema extension in datamodel-code-generator
    31Monitor
  • CVE-2026-54654`datamodel-code-generator` vulnerable to code injection via unescaped carriage return in `--extra-template-data` `comment` field
    31Monitor
  • CVE-2026-54621`datamodel-code-generator` vulnerable to code injection via unescaped carriage return in GraphQL Union description
    31Monitor

Remediation

Which version to upgrade to

Fix versions compiled from the vendor, package registries and Microsoft. Verify the vendor's note before upgrading.

Product / packageFixed versionSource
koxudaxi datamodel-code-generator0.60.2 · descriptionVendor (CNA)
PyPI:datamodel-code-generator0.60.2Package registry (OSV)

Exploit status

No known public exploit

No public exploit has been observed yet. That doesn't mean you're safe, only that the bar is a little higher.

Research context

For pentesters and researchers: attack profile, score disagreement, timeline, patch commits, credits, variant and chain candidates, bug bounty scope. All derived from existing data; no exploit code.

Timeline

From publication to today: proof of concept, Metasploit module, CISA KEV and fix record. Dates are as reported by the sources.

No dated events beyond publication.

EPSS, last 120 days

FIRST EPSS daily score; only changes of 0.01 or more are recorded (step chart).

Patch and commit links

Commit, PR and diff links among the references. A starting point for patch-diffing and variant hunting; fixes, not exploits.

Finders, reporters and analysts named in the CNA record. Click a name for that researcher’s other records.

No credits in the CNA record.

Variant candidates

Same product, same weakness class, within 18 months. If the patch missed the root cause, the sibling bug is here.

  • CVE-2026-546210 days apart`datamodel-code-generator` vulnerable to code injection via unescaped carriage return in GraphQL Union description
    31Monitor
  • CVE-2026-546540 days apart`datamodel-code-generator` vulnerable to code injection via unescaped carriage return in `--extra-template-data` `comment` field
    31Monitor
  • CVE-2026-546550 days apart`datamodel-code-generator` vulnerable to code execution on import via `x-python-type` JSON-Schema extension in datamodel-code-generator
    31Monitor
  • CVE-2026-546560 days apart`datamodel-code-generator` vulnerable to code execution on import via unescaped `validators` entries in --extra-template-data
    31Monitor
  • CVE-2026-554150 days apartdatamodel-code-generator vulnerable to code injection via `x-python-import` / `customTypePath` in generated import statements
    30Monitor
  • CVE-2026-637202 days apartdatamodel-code-generator Code Injection via Unvalidated customBasePath Schema Field
    30Monitor

Chain candidates

An authentication bypass and a privilege-requiring bug in the same product, published close together: combined they may become an unauthenticated path.

—

Bug bounty scope

No known public program.

Source: bounty-targets-data (public HackerOne, Bugcrowd, Intigriti, YesWeHack listings).

Technical details

Attack conditions

  • Anyone who can reach it over the internet can trigger it.
  • No account or password is required.
  • A user must open a link or visit a page.
  • No special conditions are required; it is repeatable.

If successful

Confidentiality
high · data can be read
Integrity
high · data or configuration can be modified
Availability
high · the service can be disrupted
Attack vector
Network
Attack complexity
Low
Privileges required
None
User interaction
Required
Scope
Unchanged
Confidentiality impact
High
Integrity impact
High
Availability impact
High

CVSS vector

CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H

nvd-secondary

Change log

  1. Fix✗ → ✓

For records you follow, these changes also arrive as notifications. →

References

All records