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. From 0.9.1 until 0.61.0, datamodel-code-generator silently dereferences attacker-controlled JSON Schema $ref HTTP or HTTPS URLs in src/datamodel_code_generator/parser/jsonschema.py through _get_ref_body, and the --allow-remote-refs gate can warn instead of blocking, allowing server-side request forgery through src/datamodel_code_generator/http.py. This issue is fixed in version 0.61.0.
Published: 2026-07-28
Score: 8.2 High
EPSS: < 1% Very Low
KEV: No
Impact: n/a
Action: n/a
AI Analysis

Impact

The vulnerability resides in datamodel‑code‑generator’s handling of JSON Schema definitions that reference external HTTP or HTTPS URLs via the $ref keyword. From version 0.9.1 until 0.61.0 the tool silently dereferenced these external references without user confirmation, enabling an attacker to supply a malicious schema that causes the generator to make outbound HTTP requests. This behavior allows a server‑side request forgery (SSRF) that can probe internal networks, exfiltrate data, or reach otherwise inaccessible services, thereby compromising confidentiality, integrity, or availability of the internal environment. The weakness is classified as CWE‑918.

Affected Systems

The affected product is datamodel‑code‑generator by koxudaxi. All releases from 0.9.1 up through 0.60.x are vulnerable. The issue was resolved in release 0.61.0, so only installations using earlier versions are at risk.

Risk and Exploitability

The CVSS score of 8.2 indicates a high severity of the flaw. The EPSS score of less than 1% suggests that the likelihood of real‑world exploitation is currently low, and the vulnerability has not been listed in the CISA Known Exploited Vulnerabilities catalog. Exploitation requires an attacker to be able to supply or influence the JSON Schema input processed by the generator, which is common in automated code‑generation workflows or CI/CD pipelines. If such an attacker successfully exploits the flaw, they can force the generator to reach arbitrary URLs within the organization’s network, leading to information disclosure or further attacks.

Generated by OpenCVE AI on August 3, 2026 at 14:11 UTC.

Remediation

No vendor fix or workaround currently provided.

OpenCVE Recommended Actions

  • Upgrade datamodel-code-generator to version 0.61.0 or newer. This release removes the silent dereference of remote $ref URLs and enforces stricter handling of external references.
  • If an upgrade is not immediately possible, configure your environment to prevent the generator from accessing external HTTP/HTTPS resources by employing firewall rules or network segmentation that block outbound requests from the machine running the generator.
  • As a temporary precaution, run the generator with the --allow-remote-refs flag disabled and monitor any warnings for unexpected external references; ensure that only trusted local schemas are fed to the tool.

Generated by OpenCVE AI on August 3, 2026 at 14:11 UTC.

Tracking

Sign in to view the affected projects.

Advisories
Source ID Title
Github GHSA Github GHSA GHSA-954p-556p-r752 datamodel-code-generator vulnerable to SSRF via JSON-Schema `$ref` to HTTP URL (silent by default)
History

Wed, 29 Jul 2026 16:30:00 +0000

Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'no', 'Exploitation': 'poc', 'Technical Impact': 'partial'}, 'version': '2.0.3'}


Wed, 29 Jul 2026 00:15:00 +0000

Type Values Removed Values Added
First Time appeared Koxudaxi
Koxudaxi datamodel-code-generator
Vendors & Products Koxudaxi
Koxudaxi datamodel-code-generator

Tue, 28 Jul 2026 22:00:00 +0000

Type Values Removed Values Added
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. From 0.9.1 until 0.61.0, datamodel-code-generator silently dereferences attacker-controlled JSON Schema $ref HTTP or HTTPS URLs in src/datamodel_code_generator/parser/jsonschema.py through _get_ref_body, and the --allow-remote-refs gate can warn instead of blocking, allowing server-side request forgery through src/datamodel_code_generator/http.py. This issue is fixed in version 0.61.0.
Title datamodel-code-generator vulnerable to SSRF via JSON-Schema `$ref` to HTTP URL (silent by default)
Weaknesses CWE-918
References
Metrics cvssV3_1

{'score': 8.2, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:L/A:N'}


Subscriptions

Koxudaxi Datamodel-code-generator
cve-icon MITRE

Status: PUBLISHED

Assigner: GitHub_M

Published:

Updated: 2026-07-29T15:24:16.907Z

Reserved: 2026-06-15T22:53:58.562Z

Link: CVE-2026-54690

cve-icon Vulnrichment

Updated: 2026-07-29T14:44:10.491Z

cve-icon NVD

Status : Analyzed

Published: 2026-07-28T22:17:40.650

Modified: 2026-08-06T19:48:09.557

Link: CVE-2026-54690

cve-icon Redhat

No data.

cve-icon OpenCVE Enrichment

Updated: 2026-08-03T14:15:05Z

Weaknesses
  • CWE-918

    Server-Side Request Forgery (SSRF)