Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessSubmit crafted JSON-Schema to codegen service
-
DeliveryEmbed malicious file:// or ../ $ref
-
ExploitParser resolves ref bypassing --no-allow-remote-refs
-
ExecutionRead arbitrary local file
-
ImpactExfiltrate 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. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – 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
Affected Packages
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
AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
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.
Primary rating from Vendor (GitHub_M).
CVSS VectorVendor: GitHub_M
Lifecycle Timeline
2DescriptionCVE.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
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.
Apply vendor patch.
Threat Intelligence Overview
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.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
Path traversal exploits occur when applications use user-controlled input to construct file system paths without proper validation.
More in Datamodel Code Generator
View allServer-side request forgery in datamodel-code-generator 0.9.1 through 0.60.x lets a malicious JSON Schema, OpenAPI, or G
Code injection via unescaped validator entries in datamodel-code-generator's --extra-template-data feature allows arbitr
Processing an attacker-controlled Protobuf schema with datamodel-code-generator 0.59.0 through 0.80.0 lets a crafted wea
A DNS rebinding flaw in datamodel-code-generator's SSRF guard allows unauthenticated remote attackers to bypass the defa
Code injection in datamodel-code-generator 0.17.0–0.60.1 allows attackers who control a schema’s default_factory value t
Code injection in datamodel-code-generator allows an attacker who controls a JSON Schema to embed arbitrary Python code
Code injection in datamodel-code-generator versions before 0.60.1 allows an attacker who provides a malicious GraphQL sc
We are generating a synthetic analysis for CVE-2026-54654. We have a lot of data: description, CVSS, CWE, tags, referenc
Remote code execution in datamodel-code-generator prior to version 0.70.0 allows attackers who control input schemas to
Arbitrary local file read in datamodel-code-generator versions 0.59.0 to 0.61.0 via path traversal in XSD parsing allows
Code injection via unsanitized schema extensions in datamodel-code-generator allows arbitrary Python code execution when
Sensitive header disclosure in datamodel-code-generator allows Authorization, Cookie, and Proxy-Authorization headers to
EUVD-2026-50078
GHSA-8359-h9fx-j6v9
NVD
CVE.org
EPSS
Vulnrichment
VulDB
Exploit-DB