Skip to main content

datamodel-code-generator EUVDEUVD-2026-50074

| CVE-2026-54690 HIGH
Server-Side Request Forgery (SSRF) (CWE-918)
2026-07-28 GitHub_M GHSA-954p-556p-r752
8.2
CVSS 3.1 · Vendor: GitHub_M
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Attacker crafts JSON Schema with internal $ref URL
  2. Delivery
    Victim developer/CI runs datamodel-codegen on it
  3. Exploit
    Tool silently dereferences ref via _get_ref_body
  4. Execution
    SSRF fetch hits internal host, redirects followed
  5. Impact
    Response reflected into generated Python code, internal data leaked

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A01:2025 - Broken Access Control
ASVS 5.0
V4 - API and Web Service URL allowlisting, SSRF prevention
MITRE ATT&CK

2 techniques across 2 tactics: Initial Access, Credential Access

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Exploitation Conditions

Requires the optional HTTP extra to be installed (pip install 'datamodel-code-generator[http]'); without it there is no network fetcher and the flaw is not reachable. The tool must be run on a JSON Schema / OpenAPI / other supported document that the attacker controls or influenced (a $ref containing an attacker-chosen HTTP/HTTPS URL). Exploitation fires under the default configuration where --allow-remote-refs is unset (None), which only warns and then fetches; it is blocked only by explicitly passing --allow-remote-refs=false. Note --url implies remote-ref fetching. The primary limiting factor is required user interaction (UI:R): a developer or automated codegen/CI step must actually invoke datamodel-codegen against the malicious document - there is no standalone network-listening service to attack.

Impact

Signals are consistent and point to a real-but-moderate priority rather than an emergency. The CVSS 3.1 vector (AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:L/A:N, base 8.2 High) reflects a network-reachable, low-complexity, unauthenticated SSRF whose severity is inflated by S:C and C:H. EPSS is low at 0.21% (11th percentile) and there is no CISA KEV listing, so no active exploitation is indicated - SSVC confirms this with exploitation:poc, automatable:no, technical-impact:partial. Public exploit code exists (two gists plus a vuldb advisory), so weaponization is trivial once a target is reachable, but the automatable:no and UI:R factors mean this cannot be sprayed at scale - it requires a developer to run the tool on an attacker-influenced schema. The vendor's C:H is arguably overstated: SSVC rates technical impact only 'partial' and the leak is limited to schema-shaped fields (title/description/properties) reflected into generated code, so C:L is more defensible. A key limiting factor not captured in the base score is that the flaw only affects installations that added the optional [http] extra. Net: prioritize patching in CI/codegen pipelines that fetch third-party schemas, but this is not a mass-exploitation internet threat.

Exploit ScenarioDerived

A developer or CI pipeline runs datamodel-codegen (installed with the [http] extra) against a JSON Schema or OpenAPI document of uncertain provenance that contains a $ref pointing at an internal URL such as http://169.254.169.254/ or an intranet admin service. With the default --allow-remote-refs=None, the tool emits only a deprecation warning and fetches the URL anyway, following redirects with no IP/host validation, then reflects the response's schema fields into the generated .py file. A public proof-of-concept exists, so no exploit development is needed.

This Week Schedule remediation this week. Why: HIGH severity (CVSS 7.0-8.9).
1 PoC candidate (unverified) Patch available 0.2% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Sep 16, 2026

Server-side request forgery in datamodel-code-generator 0.9.1 through 0.60.x lets a malicious JSON Schema, OpenAPI, or GraphQL document cause the code generator to silently fetch attacker-chosen HTTP/HTTPS $ref URLs - including internal, loopback, and link-local addresses - and reflect the fetched content into the generated Python source. Exploitation requires the optional HTTP extra (pip install 'datamodel-code-generator[http]') and a developer or automated codegen/CI job to run datamodel-codegen against the tainted document; the default configuration (--allow-remote-refs unset) only emits a deprecation warning before fetching, and only an explicit --allow-remote-refs=false blocks the request. Publicly available exploit code exists (a Gist proof-of-concept), and EPSS is low at 0.21% (11th percentile), with no confirmed active exploitation (not in CISA KEV); fixed in 0.61.0.

RemediationAI

Upgrade to datamodel-code-generator 0.61.0 or later (pip install --upgrade 'datamodel-code-generator[http]'); this is the vendor-released patch containing commit 5fdba4a, which adds the --allow-private-network gate defaulting to False and blocks non-public network targets. If immediate upgrade is not possible, the most effective compensating control is to invoke the tool with an explicit --allow-remote-refs=false, which raises an Error instead of warning and fetching - note this will break legitimate workflows that intentionally resolve remote $refs, so any needed remote schemas should be vendored locally first. Because the vulnerable behavior only triggers with the network-capable extra, uninstalling it (reinstalling the package without [http]) removes the fetcher entirely at the cost of losing remote-URL support. Running codegen only on schemas of trusted provenance, and executing datamodel-codegen inside a sandbox or CI container with egress restricted to the public internet (blocking RFC1918, 127.0.0.0/8, 169.254.0.0/16, and cloud metadata endpoints) limits both the SSRF reach and the leakage of responses into generated source; this is a defense-in-depth measure and not a substitute for patching. References: https://github.com/koxudaxi/datamodel-code-generator/security/advisories/GHSA-954p-556p-r752, https://github.com/koxudaxi/datamodel-code-generator/releases/tag/0.61.0, and https://github.com/koxudaxi/datamodel-code-generator/commit/5fdba4a09f2d7a9996a504975b7ef7d63e3715bb.

Affected VersionsENISA

datamodel-code-generator 0.9.1, < 0.61.0

Affected Packages

pypi datamodel-code-generator fix: 0.61.0

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 1 package in pypi

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

The flaw is a classic SSRF (CWE-918) rooted in the JSON Schema $ref resolution logic of src/datamodel_code_generator/parser/jsonschema.py. In the affected range, _get_ref_body() checks is_url(resolved_ref) and, when allow_remote_refs is False, raises an error - but when allow_remote_refs is None (the default added in 0.56.0), it merely calls warn_deprecated() and falls through to _get_ref_body_from_url(), which routes the URL through _get_text_from_url()/get_body() in src/datamodel_code_generator/http.py. That fetcher performs no IP or host validation, applies no scheme allow-list, and follows HTTP redirects unconditionally, so a $ref such as "$ref": "http://169.254.169.254/latest/meta-data/" or an internal service URL will be dereferenced. The retrieved body is then parsed as a sub-schema and merged into the model graph, so attacker-influenced fields (title, description, properties) are rendered verbatim into the emitted .py file - turning the SSRF into a data-exfiltration path into generated code. The fix commit 5fdba4a adds a new --allow-private-network flag (default False) to docs, __init__.py, __main__.py, and _types, blocking private/loopback/link-local targets unless explicitly allowed, and tightens the interaction between --url and --allow-remote-refs. Only installations with the [http] extra are reachable, since without it there is no network fetcher.

Know when Datamodel Code Generator gets its next vulnerability

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (GitHub_M) PRIMARY 8.2 HIGH
AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:L/A:N
vuln.today AI 6.1 MEDIUM

Unauthenticated attacker supplies a schema but a developer must run the tool (UI:R); SSRF pivots to internal systems (S:C); only reflected schema fields leak (C:L) and generated code is tainted (I:L), no availability impact.

3.1 AV:N/AC:L/PR:N/UI:R/S:C/C:L/I:L/A:N
4.0 AV:N/AC:L/AT:N/PR:N/UI:P/VC:L/VI:L/VA:N/SC:L/SI:N/SA:N

Primary rating from Vendor (GitHub_M).

CVSS VectorVendor: GitHub_M

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
Required
Scope
Changed
Confidentiality
High
Integrity
Low
Availability
None

Lifecycle Timeline

2
Patch available
Jul 28, 2026 - 23:02 EUVD
CVE Published
Jul 28, 2026 - 21:42 cve.org
HIGH 8.2

DescriptionCVE.org

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.9.1 until 0.61.0, datamodel-code-generator silently dereferences attacker-controlled JSON Schema $ref HTTP or HTTPS URLs in src/datamodel_code_generator/parser/jsonschema.py through _get_ref_body, and the --allow-remote-refs gate can warn instead of blocking, allowing server-side request forgery through src/datamodel_code_generator/http.py. This issue is fixed in version 0.61.0.

Latest POC

1 PoC candidate from github (unverified)

Sign in to open the public PoC links collected for this CVE.

Executive ViewAI

Why It Matters

A server-side request forgery flaw in datamodel-code-generator (versions 0.9.1 through 0.60.x) lets a malicious JSON Schema, OpenAPI, or GraphQL document cause developer workstations and CI/CD code-generation jobs to fetch attacker-chosen URLs - including internal, loopback, and cloud metadata endpoints - and silently embed the responses into generated Python source. Any engineering team running datamodel-codegen with the optional HTTP extra against third-party or untrusted API specifications is exposed to internal network reconnaissance and possible credential or secret theft from build environments. Because this tool typically executes inside pipelines with broad network reach, leadership should treat it as a software supply-chain and CI/CD exposure rather than a routine library update.

Business Impact: High
Compensating Controls

Apply vendor patch.

Threat Intelligence Overview

EPSS Score
0.2%
Top 89% exploitable
Prevalence
Medium
popular Python codegen library, but dev/CI-time only and gated to optional [http] extra
Threat Intel
1
1 sources
Social Media
2
Sightings
Data Quality
7 sources
Confidence: High
EUVD NVD CVE.org EPSS Vulnrichment GHSA CIRCL GitHub VulDB

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity HIGH
CISA KEV No
Public POC Yes
EPSS 0.2%
Patch available Yes
Active threat No
Deciding rule
HIGH severity (CVSS 7.0-8.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision
Scheduled
Exploitation
Poc
System Exposure· derived
Open
Automatable
No
Human Impact
High
Technical Impact
Partial

Priority Score

61
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +41
PoC: +20
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Server-Side Request Forgery exploits applications that fetch remote resources based on user-supplied URLs.

CVE-2026-54656 HIGH POC
7.8 Jul 28

Code injection via unescaped validator entries in datamodel-code-generator's --extra-template-data feature allows arbitr

CVE-2026-107377 HIGH POC
7.5 Oct 08

Processing an attacker-controlled Protobuf schema with datamodel-code-generator 0.59.0 through 0.80.0 lets a crafted wea

CVE-2026-55389 HIGH POC
7.5 Jul 28

Arbitrary local file read in datamodel-code-generator before 0.62.0 lets unauthenticated attackers who control or can su

CVE-2026-55391 HIGH POC
7.5 Jul 28

A DNS rebinding flaw in datamodel-code-generator's SSRF guard allows unauthenticated remote attackers to bypass the defa

CVE-2026-54653 HIGH
8.8 Jul 28

Code injection in datamodel-code-generator 0.17.0–0.60.1 allows attackers who control a schema’s default_factory value t

CVE-2026-54655 HIGH
7.8 Jul 28

Code injection in datamodel-code-generator allows an attacker who controls a JSON Schema to embed arbitrary Python code

CVE-2026-54621 HIGH
7.8 Jul 28

Code injection in datamodel-code-generator versions before 0.60.1 allows an attacker who provides a malicious GraphQL sc

CVE-2026-54654 HIGH
7.8 Jul 28

We are generating a synthetic analysis for CVE-2026-54654. We have a lot of data: description, CVSS, CWE, tags, referenc

CVE-2026-63720 HIGH
7.5 Jul 26

Remote code execution in datamodel-code-generator prior to version 0.70.0 allows attackers who control input schemas to

CVE-2026-55390 HIGH
7.5 Jul 28

Arbitrary local file read in datamodel-code-generator versions 0.59.0 to 0.61.0 via path traversal in XSD parsing allows

CVE-2026-55415 HIGH
7.5 Jul 28

Code injection via unsanitized schema extensions in datamodel-code-generator allows arbitrary Python code execution when

CVE-2026-55403 LOW
3.7 Jul 28

Sensitive header disclosure in datamodel-code-generator allows Authorization, Cookie, and Proxy-Authorization headers to

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy