Intel

AIKIDO-2026-128766

datamodel-code-generator is vulnerable to Path Traversal

Path TraversalCVE-2026-55389 Published 3 days ago

75

High Risk

This Affects:

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

TL;DR

datamodel-code-generator resolves JSON Schema $ref targets that point at the local filesystem without restricting them to the input base directory and without honoring the remote-reference control. An attacker who controls an input schema can use a file:// absolute URI or a ../-escaped relative reference to read arbitrary files the process can access, bypassing --no-allow-remote-refs. Values from schema-shaped nodes are reflected verbatim into the generated Python, and failed reads act as a filesystem existence and permission oracle. The fix applies the remote-reference gate to file:// refs and rejects local refs 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 JSON Schema or OpenAPI document.

Background info

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

How to fix this

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