Path Traversal in datamodel-code-generator (CVE-2026-55390)
Summary
Path traversal in datamodel-code-generator (CVE-2026-55390). Confidential information can be exposed externally. Exploitable via schemaLocation. Mitigation: upgrade to 0.62.0 or later.
Original description
The description as published by the source.
Summary
When generating models from an XML Schema (--input-file-type xmlschema), datamodel-code-generator resolves , , , and schemaLocation attributes against the source directory and reads the target with no restriction to the input/base directory. An attacker who controls the input XSD can read arbitrary files via ../ traversal or an absolute path, and the included schema's contents (type names, restrictions, enumerations) are folded into the generated output. Unlike the JSON-Schema $ref path, there is no allow_remote_refs control for XSD, so --no-allow-remote-refs does not mitigate it. This is an unauthenticated path-traversal / information-disclosure issue reachable in the default configuration.
Details
The XSD parser walks include-style children and reads each schemaLocation with only an is_file() check (src/datamodel_code_generator/parser/xmlschema.py):
location = (source_dir / schema_location).resolve() # .resolve() collapses ../, escapes base
if location in seen or not location.is_file():
continue
included_root = self._parse_schema(_read_xml_text(location, self.encoding), location)
schema_location is attacker-controlled and _read_xml_text does path.read_bytes(). Because (source_dir / schema_location).resolve() normalizes .. and accepts absolute paths, the resolved target can be any file the process can read; there is no is_relative_to(base_path) containment (contrast the JSON-Schema HTTP-local b…
Source: GitHub Security Advisories (Global) NVD GitHub Advisory
Auto-generated summary
Assembled by SecPulse from the source data (CVSS, CWE, affected versions) using templates — no AI involved. Check the original description and references below for exact details.
A vulnerability tracked as CVE-2026-55390 has been found in datamodel-code-generator.
Attackers can target a specific entry point like schemaLocation over the network to misuse the product.
Confidential information can be exposed externally. CVSS score: 7.5/10.
What to do: upgrade datamodel-code-generator to 0.62.0 or later.
If unsure, ask your IT team or search "datamodel-code-generator CVE-2026-55390" on the vendor's site.
CVE-2026-55390 (datamodel-code-generator) — CWE-22 / CVSS v3 7.5
Attack vector: remote (network-reachable) / unauthenticated / no user interaction
Attack surface: schemaLocation / allow_remote_refs / schema_location / _read_xml_text
Patched: 0.62.0 — apply immediately
Plan: 1) Audit SBOM/dependencies, 2) Stage→prod upgrade, 3) Add WAF/proxy monitoring on affected endpoints, 4) Hunt IOCs in logs.
Refs: see the GHSA / vendor advisory / patched release linked on this page.
Path traversal (CWE-22) exists in datamodel-code-generator. Attackers reach the vulnerable code path via schemaLocation without authentication.
Check the vendor advisory for the affected versions of datamodel-code-generator. Attack surface: schemaLocation / allow_remote_refs / schema_location / _read_xml_text.
Severity: High (CVSS 7.5/10). Confidential information can be exposed externally.
Update to 0.62.0.
Until the patch is applied: disable the affected feature, apply WAF rules, or restrict access via network ACLs.
Search webserver/proxy logs for unusual request patterns matching this CVE's known IOCs. Run grep -r 'datamodel-code-generator' . against your dependency files (package-lock.json, requirements.txt, go.sum) to find affected services.
Response actions
Concrete steps and command examples for SOC/SRE teams to execute in order
-
1Identify exposure identify
grep -r 'datamodel-code-generator' . | grep -v node_modulesリポジトリと本番環境の依存ファイル (package-lock.json / requirements.txt / go.sum / Gemfile.lock 等) で
datamodel-code-generatorを grep し、稼働しているサービス・バージョンを把握する。 -
2Apply patch patch
Upgrade datamodel-code-generator to 0.62.0ステージング環境で 0.62.0 に上げて回帰テスト → 本番反映。回帰テストはアプリの主要ハッピーパスを含めること。
-
3Post-deployment verification verify
Confirm patched version is live in productionパッチ適用後、ステージングで PoC または同等の悪用パターンを再現して脆弱性が閉じたことを確認。本番ではアクセスログ・WAF でアラート再発が無いか継続監視。
Affected packages
References
- advisory github.com
- advisory nvd.nist.gov
- package github.com
- package pypi.org
- web github.com
- web github.com
- web github.com