CVE-2026-55389
PoC moderatePath Traversal Arbitrary File Read in datamodel-code-generator before 0.62.0
datamodel-code-generator before 0.62.0 fails to validate JSON Schema $ref targets when resolving references via is_url and _get_ref_body, so crafted $ref values (file:// URIs or ../ traversals outside the input directory) cause the tool to read arbitrary local files, and the --no-allow-remote-refs option is not honored on affected versions. An attacker who can supply or influence a JSON Schema, OpenAPI, or similar document processed by the generator gains unauthorized read access to files accessible to the process running it, with high confidentiality impact but no integrity or availability impact. Anyone running affected versions on untrusted or attacker-controlled inputs — such as CI pipelines or services that generate models from third-party specs — is affected, while fully trusted local inputs are largely unaffected. No in-the-wild exploitation is currently known: the project has published a security advisory (GHSA-8359-h9fx-j6v9) with a public reference, the flaw is not in CISA KEV, and EPSS estimates only about a 0.4% probability of exploitation in the next 30 days.
What to do: Upgrade datamodel-code-generator to 0.62.0 or later. Until upgraded, avoid running the generator on untrusted or attacker-controlled JSON Schema/OpenAPI documents and restrict $ref targets to files within the input directory, noting that --no-allow-remote-refs does not reliably mitigate on affected versions. Audit CI pipelines, dependency lockfiles, and vendored tooling for pinned versions below 0.62.0.
| koxudaxi datamodel-code-generator | all versions prior to 0.62.0 (< 0.62.0) |
Order-of-magnitude estimate by the model from install counts, market share and public scan data it knows; verify before quoting.
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.
- Vendors
- koxudaxi
- Products
- datamodel-code-generator
- Weakness
- CWE-22, CWE-200, CWE-610
- Vector
- CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N
In the news0 stories
No ingested article mentions this CVE yet.