CVE-2026-55389: CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') in koxudaxi datamodel-code-generator
datamodel-code-generator generates Pydantic v2 models, dataclasses, TypedDict, and msgspec.Struct from OpenAPI, JSON Schema, GraphQL, Avro, Protobuf, and raw JSON, YAML, or CSV. Prior to 0.62.0, datamodel-code-generator resolves JSON Schema $ref targets in src/datamodel_code_generator/parser/jsonschema.py through is_url and _get_ref_body without containing file:// or ../ traversal references to the input directory and without honoring --no-allow-remote-refs, allowing arbitrary local file reads. This issue is fixed in version 0.62.0.
AI Analysis
Technical Summary
The datamodel-code-generator tool, used to generate Pydantic v2 models and other data structures from various schema formats, had a vulnerability in versions before 0.62.0. Specifically, the JSON Schema $ref resolution logic in src/datamodel_code_generator/parser/jsonschema.py failed to properly restrict references to local files, allowing path traversal via file:// or ../ sequences. This allowed an attacker to cause the tool to read arbitrary local files. The vulnerability is identified as CWE-22 (Improper Limitation of a Pathname to a Restricted Directory) and is fixed in version 0.62.0.
Potential Impact
An attacker can exploit this vulnerability to read arbitrary local files on the system where datamodel-code-generator is run. This can lead to disclosure of sensitive information. The CVSS score is 7.5 (High), indicating a significant confidentiality impact without requiring privileges or user interaction.
Mitigation Recommendations
Upgrade datamodel-code-generator to version 0.62.0 or later, where this path traversal vulnerability is fixed. There is no indication of alternative mitigations or temporary workarounds. Patch status is confirmed fixed in 0.62.0.
CVE-2026-55389: CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') in koxudaxi datamodel-code-generator
Description
datamodel-code-generator generates Pydantic v2 models, dataclasses, TypedDict, and msgspec.Struct from OpenAPI, JSON Schema, GraphQL, Avro, Protobuf, and raw JSON, YAML, or CSV. Prior to 0.62.0, datamodel-code-generator resolves JSON Schema $ref targets in src/datamodel_code_generator/parser/jsonschema.py through is_url and _get_ref_body without containing file:// or ../ traversal references to the input directory and without honoring --no-allow-remote-refs, allowing arbitrary local file reads. This issue is fixed in version 0.62.0.
CVSS v3.1
Score 7.5high
Affected software
koxudaxi
datamodel-code-generator
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
The datamodel-code-generator tool, used to generate Pydantic v2 models and other data structures from various schema formats, had a vulnerability in versions before 0.62.0. Specifically, the JSON Schema $ref resolution logic in src/datamodel_code_generator/parser/jsonschema.py failed to properly restrict references to local files, allowing path traversal via file:// or ../ sequences. This allowed an attacker to cause the tool to read arbitrary local files. The vulnerability is identified as CWE-22 (Improper Limitation of a Pathname to a Restricted Directory) and is fixed in version 0.62.0.
Potential Impact
An attacker can exploit this vulnerability to read arbitrary local files on the system where datamodel-code-generator is run. This can lead to disclosure of sensitive information. The CVSS score is 7.5 (High), indicating a significant confidentiality impact without requiring privileges or user interaction.
Mitigation Recommendations
Upgrade datamodel-code-generator to version 0.62.0 or later, where this path traversal vulnerability is fixed. There is no indication of alternative mitigations or temporary workarounds. Patch status is confirmed fixed in 0.62.0.
Technical Details
- Data Version
- 5.2
- Assigner Short Name
- GitHub_M
- Date Reserved
- 2026-06-16T18:57:40.183Z
- Cvss Version
- 3.1
- State
- PUBLISHED
Threat ID: 6a6924a99c2644c7f842567c
Added to database: 07/28/2026, 21:52:41 UTC
Last enriched: 07/29/2026, 13:23:37 UTC
Last updated: 09/11/2026, 14:28:07 UTC
Views: 91
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.