Description
datamodel-code-generator generates Python data models from schema definitions. From 0.59.0 until 0.62.0, XML Schema parsing in src/datamodel_code_generator/parser/xmlschema.py for --input-file-type xmlschema resolves xs:include, xs:import, xs:redefine, and xs:override schemaLocation values outside the input base path, allowing arbitrary local files to be read and reflected into generated models. This issue is fixed in version 0.62.0.
Published: 2026-07-28
Score: 7.5 High
EPSS: < 1% Very Low
KEV: No
Impact: n/a
Action: n/a
AI Analysis

Impact

datamodel-code-generator is a tool that produces Python data models from schema files. In versions 0.59.0 through 0.61.x the XML schema parser resolves xs:include, xs:import, xs:redefine, and xs:override schemaLocation references outside the input base directory, allowing an adversary to read any local file and embed its contents into the generated model, resulting in information disclosure and corresponding to CWE‑200, CWE‑22, and CWE‑610.

Affected Systems

The affected product is datamodel-code-generator from koxudaxi. Versions 0.59.0 to 0.61.x inclusive are vulnerable; the issue was fixed in 0.62.0 and later.

Risk and Exploitability

The vulnerability receives a CVSS score of 7.5, indicating a high severity for confidentiality impact. The EPSS score is less than 1%, suggesting a low probability of exploitation. Because the flaw requires the ability to supply a crafted XML schema to the generator, the attack vector is local; any user who can invoke datamodel-code-generator can use a malicious schemaLocation to read arbitrary files. The issue is not listed in the CISA KEV catalog, and there are no known public exploits, but the potential for sensitive data leakage warrants immediate action.

Generated by OpenCVE AI on August 4, 2026 at 12:47 UTC.

Remediation

No vendor fix or workaround currently provided.

OpenCVE Recommended Actions

  • Upgrade to datamodel-code-generator 0.62.0 or later, where the path traversal bug is fixed.
  • If an upgrade is not immediately possible, run the generator inside a sandboxed environment with read‑only access to the file system to constrain potential local file reads.
  • Validate all XML schemas before processing, restricting schemaLocation references to trusted directories and ensuring that any supplied schema originates from a verified source.

Generated by OpenCVE AI on August 4, 2026 at 12:47 UTC.

Tracking

Sign in to view the affected projects.

Advisories
Source ID Title
Github GHSA Github GHSA GHSA-442q-2j6p-642g datamodel-code-generator vulnerable to arbitrary local file read via XSD `schemaLocation` (`xs:include`/`xs:import`) path traversal, with no remote-ref gate
History

Wed, 29 Jul 2026 15:30:00 +0000

Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'yes', 'Exploitation': 'poc', 'Technical Impact': 'partial'}, 'version': '2.0.3'}


Tue, 28 Jul 2026 22:45:00 +0000

Type Values Removed Values Added
First Time appeared Koxudaxi
Koxudaxi datamodel-code-generator
Vendors & Products Koxudaxi
Koxudaxi datamodel-code-generator

Tue, 28 Jul 2026 21:30:00 +0000

Type Values Removed Values Added
Description datamodel-code-generator generates Python data models from schema definitions. From 0.59.0 until 0.62.0, XML Schema parsing in src/datamodel_code_generator/parser/xmlschema.py for --input-file-type xmlschema resolves xs:include, xs:import, xs:redefine, and xs:override schemaLocation values outside the input base path, allowing arbitrary local files to be read and reflected into generated models. This issue is fixed in version 0.62.0.
Title Arbitrary local file read via XSD `schemaLocation` (`xs:include`/`xs:import`) path traversal, with no remote-ref gate
Weaknesses CWE-200
CWE-22
CWE-610
References
Metrics cvssV3_1

{'score': 7.5, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N'}


Subscriptions

Koxudaxi Datamodel-code-generator
cve-icon MITRE

Status: PUBLISHED

Assigner: GitHub_M

Published:

Updated: 2026-07-29T14:16:03.510Z

Reserved: 2026-06-16T18:57:40.183Z

Link: CVE-2026-55390

cve-icon Vulnrichment

Updated: 2026-07-29T14:13:48.620Z

cve-icon NVD

Status : Deferred

Published: 2026-07-28T22:17:48.557

Modified: 2026-07-30T20:02:44.977

Link: CVE-2026-55390

cve-icon Redhat

No data.

cve-icon OpenCVE Enrichment

Updated: 2026-08-04T13:00:11Z

Weaknesses
  • CWE-200

    Exposure of Sensitive Information to an Unauthorized Actor

  • CWE-22

    Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')

  • CWE-610

    Externally Controlled Reference to a Resource in Another Sphere