Intel

AIKIDO-2026-687744

datamodel-code-generator is vulnerable to Path Traversal

CVE-2026-55390Published Jul 24, 2026
July 24, 2026

75

CVE Score

High

Path Traversal

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.

How do I fix this?

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

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

Versions

0.59.0 - 0.61.0

Fixed in 0.62.0

Background info

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

Get secure today,
quickly and for free.

Secure your code, cloud, and runtime in one central system. Connect a repo to discover what the reasoning agents find in your codebase.

No credit card required | Scan results in 32 seconds.

Trusted by 150k+ orgs
  • Revolut
  • n8n
  • Lovable
  • Deel
  • Prove
  • Omnea