CVE-2026-55389: koxudaxi datamodel-code-generator local file read via JSON Schema ref

CVE-2026-55389 · Severity: high · CVSS 7.5 · Published 2026-07-28

datamodel-code-generator is a tool used by developers to automatically create Python code from data schemas like OpenAPI or JSON Schema. A security flaw in this tool allows a specially crafted schema file to read sensitive files from the computer or server running the generator. This is particularly dangerous for web-based services or automated build systems that process user-provided schema files, as it could lead to the theft of configuration files, credentials, or other private data.

Technologies: Koxudaxi Datamodel-Code-Generator, datamodel-code-generator (PyPI). Vendors: Koxudaxi, PyPI.

Quick answers

Is CVE-2026-55389 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2026-55389 being exploited in the wild.
How severe is CVE-2026-55389?
High severity, with a CVSS score of 7.5, published 28 July 2026.
Which products and versions are affected?
Koxudaxi Datamodel-Code-Generator < 0.62.0, <= 0.61.0; datamodel-code-generator (PyPI) ECOSYSTEM:introduced=0,fixed=0.62.0.
Is there a fix for CVE-2026-55389?
Yes. datamodel-code-generator (PyPI): upgrade to 0.62.0 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2026-55389 attacked?
It is attacked over the network, in a software library.
Am I affected by CVE-2026-55389?
Check whether you run Koxudaxi Datamodel-Code-Generator or datamodel-code-generator (PyPI) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

  • datamodel-code-generator (PyPI): upgrade to 0.62.0 or later
    pip install "datamodel-code-generator>=0.62.0"

Technical details

A path traversal and information disclosure vulnerability exists in datamodel-code-generator's JSON Schema parser. The root cause is located in `src/datamodel_code_generator/parser/jsonschema.py` within the `_get_ref_body` method, which fails to restrict `$ref` targets to the input directory. Specifically, the `is_url` check classifies `file://` URIs as URLs but then explicitly exempts them from the `allow_remote_refs` security gate. This allows an attacker to use absolute `file://` URIs or relative `../` traversal sequences to read any file accessible to the process user. The vulnerability is exploitable in any environment where the generator processes untrusted schemas, such as multi-tenant codegen platforms or CI/CD pipelines. The issue is fixed in version 0.62.0 by enforcing base-path containment and honoring the remote-reference block for local file URIs.

Affected products

  • koxudaxi datamodel-code-generator < 0.62.0

Identifiers

  • CVE-2026-55389
  • GHSA-8359-h9fx-j6v9
  • PYSEC-2026-3558

Timeline

  • 2026-06-10: patched: Version 0.62.0 released
  • 2026-06-11: other: Fix commit merged to main branch
  • 2026-06-12: advisory: GitHub Security Advisory GHSA-8359-h9fx-j6v9 published
  • 2026-07-28: disclosed: CVE-2026-55389 published to NVD

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.