Skip to main content

datamodel-code-generator EUVDEUVD-2026-50078

| CVE-2026-55389 HIGH
Path Traversal (CWE-22)
2026-07-28 GitHub_M GHSA-8359-h9fx-j6v9
7.5
CVSS 3.1 · Vendor: GitHub_M
View

Attack ChainAIDerived

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

  1. Access
    Submit crafted JSON-Schema to codegen service
  2. Delivery
    Embed malicious file:// or ../ $ref
  3. Exploit
    Parser resolves ref bypassing --no-allow-remote-refs
  4. Execution
    Read arbitrary local file
  5. Impact
    Exfiltrate contents via generated model/output

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A01:2025 - Broken Access Control
ASVS 5.0
V5 - File Handling Path canonicalization, traversal prevention
MITRE ATT&CK

2 techniques across 2 tactics: Discovery, Collection

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

Exploitation Conditions

Exploitation requires that the target runs datamodel-code-generator (< 0.62.0) on a JSON-Schema (or OpenAPI/other schema) input that the ATTACKER controls or can submit - e.g. a hosted 'paste your schema' codegen endpoint, a CI job generating models from user-submitted specs, or a multi-tenant codegen platform. The malicious schema must contain a $ref using either a file:// absolute URI or a ../-based relative path escaping the input base directory. Notably, the --no-allow-remote-refs security control does NOT limit this because is_url() exempts file:// from the remote-ref gate and the plain-relative branch performs no is_relative_to(base_path) check. The key LIMITING factor is trust of the input: if the tool is only ever run against schemas authored by the operator (typical local developer CLI workflow), there is no untrusted-input path and the flaw is not remotely triggerable. Read access is bounded by the OS permissions of the process user.

Impact

This is a genuine but moderate-priority information-disclosure issue, and the signals are internally consistent rather than conflicting. The vendor CVSS 7.5 (AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N) captures the worst realistic case: a multi-tenant or 'paste-your-OpenAPI-schema' codegen service, or a CI job that generates models from attacker-submitted specs, where a malicious JSON-Schema $ref reaches the parser over the network with no authentication. SSVC (Exploitation: poc, Automatable: yes, Technical Impact: partial) aligns with this - a POC exists (public gist), exploitation is scriptable, but impact is partial (arbitrary local file READ only; no integrity or availability impact, no code execution). EPSS is low at 0.36% (29th percentile) and there is NO CISA KEV listing, so despite public POC availability there is no evidence of active exploitation - POC availability and active exploitation are distinct, and here only the former is present. The confidentiality rating C:H is well-justified since the flaw reads any file the process user can access (secrets, tokens, /etc/passwd, source). One nuance defenders should weigh: the AV:N rating only holds in networked/service deployments - for the common case of a developer running the CLI locally against their own trusted schema, the realistic vector is local with user interaction (AV:L/UI:R), which materially lowers exposure. Net: real, worth patching promptly on any service that ingests untrusted schemas, but not a drop-everything emergency for typical local CLI usage.

Exploit ScenarioDerived

An attacker submits a crafted OpenAPI/JSON-Schema to a hosted codegen service, CI pipeline, or multi-tenant platform that runs datamodel-code-generator on untrusted input. The schema contains a $ref pointing to 'file:///etc/passwd' (absolute) or '../../secret/config.json' (relative traversal), which the parser resolves and reads with no containment check, embedding the file contents into generated output or error surfaces. A public POC exists (gist by alon710), and because the flaw bypasses even the --no-allow-remote-refs control, no special hardening short of upgrading blocks it.

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

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

Alert me

AnalysisAIv1 – Sep 16, 2026

Arbitrary local file read in datamodel-code-generator before 0.62.0 lets unauthenticated attackers who control or can submit a JSON-Schema/OpenAPI input exfiltrate any file readable by the codegen process, because JSON-Schema $ref targets using a file:// URI or a ../ traversal are resolved without containment and even bypass the documented --no-allow-remote-refs control. Exploitation requires the tool to be run against an attacker-supplied schema (for example a hosted 'paste your schema' service, a CI job generating models from submitted specs, or a multi-tenant codegen platform); a local developer running the CLI only on their own schemas has no untrusted-input path and is not remotely triggerable. Publicly available exploit code exists (a public gist, tracked by SSVC as Exploitation: PoC and Automatable: yes), but the issue is not in CISA KEV and EPSS is low at 0.36% (29th percentile), so mass exploitation has not been observed.

RemediationAI

Vendor-released patch: 0.62.0 - upgrade the pip package to datamodel-code-generator 0.62.0 or later (https://github.com/koxudaxi/datamodel-code-generator/releases/tag/0.62.0), which contains the fix commit 2ff4a72b4550a2b2069754c5b075b1655067e5fb adding the _resolve_local_ref_path() containment check. Upgrading alone is not sufficient for untrusted-input deployments: in 0.62.0 the default behavior (allow_remote_refs unset) only warns and still resolves out-of-base references, so operators processing submitted schemas must also pass --no-allow-remote-refs, which turns such $refs into a hard 'Blocked unsafe local $ref' error; the trade-off is that this also rejects legitimate external HTTP(S) and local schema references, which then must be relocated under the input directory (or the flag replaced with an explicit --allow-remote-refs for trusted inputs, accepting the risk). For pre-patch environments where upgrading is not yet possible, the effective compensating control is isolation rather than a flag: run codegen in a container or sandbox with a read-only, minimal filesystem view containing only the schema and its intended dependencies, run the process as a low-privilege user with no access to secrets/customer data, and disable or gate any feature that accepts external schema submissions; do not rely on --no-allow-remote-refs before 0.62.0 because file:// and ../ refs bypass it entirely. Where user-supplied schemas must be accepted, pre-validate or strip $ref values that use the file:// scheme or contain ../ before invocation. Additional advisory context is at https://github.com/koxudaxi/datamodel-code-generator/security/advisories/GHSA-8359-h9fx-j6v9.

Affected VersionsENISA

datamodel-code-generator < 0.62.0

Affected Packages

pypi datamodel-code-generator fix: 0.62.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

datamodel-code-generator is a Python codegen tool (distributed as pip package datamodel-code-generator, CPE cpe:2.3:a:koxudaxi:datamodel-code-generator) that turns OpenAPI, JSON Schema, GraphQL, Avro, Protobuf, and raw JSON/YAML/CSV into Pydantic v2 models, dataclasses, TypedDict, and msgspec.Struct. The root cause is CWE-22 (Path Traversal) in src/datamodel_code_generator/parser/jsonschema.py: the helper is_url() classifies references beginning with https://, http:// or file:// as URLs, and _get_ref_body() then explicitly exempts file:// from the remote-reference gate ('if not resolved_ref.startswith("file://") ... if self.allow_remote_refs is False: raise Error'), so --no-allow-remote-refs never applies to file:// refs. The file:// branch (_get_ref_body_from_url) converts the URI path with url2pathname(urlparse(ref).path) and passes it straight to load_data_from_path() with no check that it stays within the input base path, and the plain relative branch (_get_ref_body_from_remote) computes full_path = self.base_path / resolved_ref without any Path.is_relative_to(base_path) validation, letting ../ escape the input directory. By contrast, the HTTP-local-ref branch (_get_ref_body_from_local_http_path) does enforce is_relative_to(base_path), confirming the omission is a gap in the filesystem branches rather than an intentional design choice. This is a local-filesystem disclosure issue distinct from the previously hardened HTTP $ref/--url SSRF in http.py; read scope is bounded by the OS permissions of the process user. The 0.62.0 fix introduces a _resolve_local_ref_path() helper that resolves the candidate path, permits it when it is relative to the input base path or when allow_remote_refs is True, emits a FutureWarning and still resolves when allow_remote_refs is None (default), and raises an Error ('Blocked unsafe local $ref') when --no-allow-remote-refs is explicitly set.

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 7.5 HIGH
AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
vuln.today AI 7.5 HIGH

Worst-case networked codegen service processes attacker schema unauthenticated with no interaction (AV:N/PR:N/UI:N); arbitrary local file read gives C:H, no integrity/availability impact; local CLI use would instead be AV:L/UI:R.

3.1 AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
4.0 AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/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
None
Scope
Unchanged
Confidentiality
High
Integrity
None
Availability
None

Lifecycle Timeline

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

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. Prior to 0.62.0, datamodel-code-generator resolves JSON Schema $ref targets in src/datamodel_code_generator/parser/jsonschema.py through is_url and _get_ref_body without containing file:// or ../ traversal references to the input directory and without honoring --no-allow-remote-refs, allowing arbitrary local file reads. This issue is fixed in version 0.62.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 high-severity file-disclosure flaw in the Python tool datamodel-code-generator (versions before 0.62.0) allows anyone who can supply a schema to that tool to read any file the code-generation process can access, potentially exposing credentials, tokens, configuration, or proprietary source code. Organizations are only exposed where untrusted schema input reaches the tool - hosted 'paste your schema' services, CI/CD pipelines that generate models from submitted specifications, or multi-tenant code-generation platforms - while developers running the CLI against their own schemas face no untrusted-input path. Publicly available exploit code exists but there is no evidence of active exploitation, so leadership attention should focus on identifying and patching any automation or service that processes externally supplied schemas.

Business Impact: High
Compensating Controls

Apply vendor patch.

Threat Intelligence Overview

EPSS Score
0.4%
Top 71% exploitable
Prevalence
Medium
popular Python model-codegen library, common in dev/CI but not universally deployed
Threat Intel
1
1 sources
Social Media
3
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.4%
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
Yes
Human Impact
High
Technical Impact
Partial

Priority Score

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

Attack Technique

Path traversal exploits occur when applications use user-controlled input to construct file system paths without proper validation.

CVE-2026-54690 HIGH POC
8.2 Jul 28

Server-side request forgery in datamodel-code-generator 0.9.1 through 0.60.x lets a malicious JSON Schema, OpenAPI, or G

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-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