CVE-2026-54690: datamodel-code-generator vulnerable to SSRF via JSON-Schema `$ref` to HTTP URL (silent by default)
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.
Security readout for executives and security teams
Plain-English summary
Affected systems may make hidden outbound web requests when processing an attacker-controlled schema. This can expose internal services or sensitive response data to the generator process. The vulnerable behavior affects versions 0.9.1 through 0.60.x and is fixed in 0.61.0.
Executive priority
Prioritize remediation where code generation handles customer, partner, repository, or otherwise untrusted schemas and has internal network access. Upgrade promptly, then verify egress restrictions. Lower urgency may be reasonable for isolated environments processing only controlled inputs, but affected versions should still be removed from standard builds.
Technical view
CVE-2026-54690 is an SSRF vulnerability in datamodel-code-generator. Attacker-controlled HTTP or HTTPS URLs in JSON Schema `$ref` values are dereferenced through `_get_ref_body`. The `--allow-remote-refs` control may warn rather than block. CVSS 3.1 is 8.2, reflecting possible high confidentiality and low integrity impact across a changed security scope.
Likely exposure
Exposure is most likely where versions 0.9.1 through 0.60.x process untrusted or externally supplied JSON Schema or OpenAPI content. Risk increases when the generator can reach internal services, cloud metadata endpoints, or other restricted networks. Installations processing only trusted inputs still require review because remote dereferencing was silent by default.
Exploitation context
The supplied sources do not establish active exploitation, and the CVE is not listed as KEV in the source bundle. Exploitation requires a user or automated workflow to process attacker-controlled schema content. The resulting server-side request originates from the environment running datamodel-code-generator, potentially bypassing external network boundaries.
Researcher notes
The vulnerable path is identified in `parser/jsonschema.py` through `_get_ref_body`, with requests handled through `http.py`. The advisory states the remote-reference gate could warn without blocking. Assess trust boundaries, reachable destinations, redirect behavior, credentials available to the process, and whether fetched content can influence generated output. The supplied evidence does not document public exploitation.
Mitigation direction
Upgrade datamodel-code-generator to version 0.61.0 or later.
Restrict schema ingestion to trusted, authenticated sources until upgrading.
Limit outbound network access from code-generation environments using allowlists or equivalent controls.
Review vendor guidance for any additional configuration or backport instructions.
Validation and detection
Inventory installed and embedded datamodel-code-generator versions across development, CI, and automation environments.
Identify workflows that accept external JSON Schema, OpenAPI, or other attacker-influenced input.
Verify upgraded environments reject unauthorized remote references rather than merely warning.
Review network logs for unexpected HTTP or HTTPS requests originating from code-generation systems.
Generated from the cited source records. This long-tail analysis has not been individually reviewed by a named human.
Potential ATT&CK relevance
Conservative CVE-to-ATT&CK context
These mappings and lookup hints may be relevant to the vulnerability behavior, CWE, affected product, or exposure path. Glexia-inferred context is not an official MITRE, ATT&CK, CWE, or CVE Program mapping.
ATT&CK lookup starting points
Use these exact CWE pages and searches to review the Glexia ATT&CK library from this CVE's weakness and description context.
cwe · medium confidence lookup
CWE-918: Information exposure and cloud metadata lookup
Information exposure and SSRF weaknesses can make discovery, cloud metadata, and credential material review relevant. Open the exact CWE lookup page first, then review the ATT&CK searches from that MITRE weakness context. This is a Glexia lookup hint, not an official ATT&CK mapping.
The CVE wording references SSRF or metadata access, so cloud discovery and credential material review may help. This is a Glexia inferred lookup path, not an official MITRE, ATT&CK, or CVE Program mapping.
These fields come from the CVE record and ADP containers, not from Glexia's Take. They preserve time-varying source decisions such as CISA SSVC, KEV status, CVSS metrics, and provider references.
We collect every scored CVSS vector available in the official CNA and ADP containers. When more than one version is present, the table keeps the source vectors side by side instead of collapsing them into the highest score.
CWE links open Glexia weakness intelligence pages with official CWE context, developer remediation guidance, and related CVE mappings.
CWE-918 · source CWE mapping
Server-Side Request Forgery (SSRF)
Server-Side Request Forgery (SSRF) represents a recurring weakness pattern that can create exploitable paths when design, validation, or implementation controls are missing.