Intel

AIKIDO-2026-687744

datamodel-code-generator is vulnerable to Path Traversal

Path TraversalCVE-2026-55390 Published 3 days ago

75

High Risk

This Affects:

PYTHONdatamodel-code-generator
0.59.0 - 0.61.0
Fixed in 0.62.0
Are you affected? Scan for Free

TL;DR

When generating models from an XML Schema, datamodel-code-generator resolves the schemaLocation attribute on xs:include, xs:import, xs:redefine, and xs:override against the source directory and reads the target with only an existence check. An attacker who controls the input XSD can use ../ traversal or an absolute path to read files outside the input base directory, and schema-shaped contents are folded into the generated code. Unlike the JSON Schema $ref path there is no remote-reference gate, so disabling remote references does not block it. The fix rejects schemaLocation targets that resolve outside the input base path.

Who does this affect?

You are affected if you are using a version that falls within the vulnerable range and generate models from an untrusted XML Schema (--input-file-type xmlschema).

Background info

datamodel-code-generator is vulnerable to Path Traversal in versions 0.59.0 - 0.61.0.

How to fix this

Upgrade the datamodel-code-generator library to the patch version.