CVE-2026-55390 in datamodel-code-generatorinfo

Summary

by MITRE • 07/29/2026

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.

If you want to get the best quality for vulnerability data then you always have to consider VulDB.

Analysis

by VulDB Data Team • 07/29/2026

The datamodel-code-generator project represents a significant tool in the Python ecosystem for automated data model generation from various schema definitions including xmlschema. This vulnerability affects versions between 0.59.0 and 0.62.0 where the XML Schema parser specifically handles schema resolution operations. The core issue manifests in how the parser processes xs:include, xs:import, xs:redefine, and xs:override elements within XML schema documents. These elements are designed to reference external schema components, but the implementation fails to properly constrain the resolution of schemaLocation values relative to the input base path.

The technical flaw stems from inadequate path validation and sanitization during the XML Schema parsing process. When processing these schema elements, the parser accepts absolute or relative paths that can traverse outside the intended input directory boundaries. This allows attackers to craft malicious schema files that reference local system files through the schemaLocation attributes. The vulnerability operates as a classic path traversal attack vector where external references are not properly validated against the input file's base directory context.

The operational impact of this vulnerability extends beyond simple information disclosure. When an attacker can manipulate the schema parsing process to read arbitrary local files, they gain access to potentially sensitive data that might exist on the system where the code generation occurs. This could include configuration files, credential stores, or other system artifacts that should remain isolated from the code generation environment. The reflected content then becomes part of the generated Python models, potentially exposing internal system structures or sensitive information through the generated code artifacts.

This vulnerability aligns with CWE-22 Path Traversal and CWE-352 Cross-Site Request Forgery patterns as it allows unauthorized file access through schema resolution mechanisms. From an ATT&CK perspective, this maps to T1059 Command and Scripting Interpreter for executing arbitrary code through the generation process, and potentially T1566 Phishing for initial compromise if attackers can influence the input schemas used in automated build processes. The vulnerability particularly affects environments where schema files are processed from untrusted sources or where multiple users contribute to schema definitions in shared development environments.

The fix implemented in version 0.62.0 addresses this by enforcing proper path validation and restricting schema location resolution to the input file's base path context. This ensures that xs:include, xs:import, xs:redefine, and xs:override elements can only reference files within the designated input directory boundaries. Organizations should immediately upgrade to version 0.62.0 or later to remediate this vulnerability. Additionally, administrators should implement strict input validation policies for schema files used in automated code generation workflows and consider running the tool in restricted environments with limited file system access to minimize potential impact even if other vulnerabilities exist.

Responsible

GitHub M

Reservation

06/16/2026

Disclosure

07/29/2026

Moderation

accepted

CPE

ready

EPSS

0.00000

KEV

no

Activities

low

Sources

Do you want to use VulDB in your project?

Use the official API to access entries easily!