# CVE-2026-54691: koxudaxi datamodel-code-generator SSRF in remote schema fetching

Source: https://junglewise.ai/threats/cve-2026-54691-koxudaxi-datamodel-code-generator-ssrf-in-remote-schema-fetching  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-07-28. Updated: 2026-07-28  
License: CC BY 4.0 with a link back

CVE-2026-54691 · Severity: high · CVSS 8.2 · Published 2026-07-28

datamodel-code-generator is a tool used to automatically create Python code from data schemas. A security flaw allows the tool to be tricked into accessing sensitive internal network resources, such as cloud metadata services or private internal APIs, when processing a malicious URL. If an attacker convinces a user to run the tool against a malicious link, private data from the user's internal network could be captured and embedded directly into the generated Python source code, potentially leading to the theft of credentials or other sensitive information.

Technologies: [Koxudaxi Datamodel-Code-Generator](https://junglewise.ai/threats/technologies/datamodel-code-generator), [datamodel-code-generator (PyPI)](https://junglewise.ai/threats/technologies/pypi-datamodel-code-generator). Vendors: [Koxudaxi](https://junglewise.ai/threats/vendors/koxudaxi), [PyPI](https://junglewise.ai/threats/vendors/pypi).

## Quick answers

**Is CVE-2026-54691 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2026-54691 being exploited in the wild.

**How severe is CVE-2026-54691?** High severity, with a CVSS score of 8.2, published 28 July 2026.

**Which products and versions are affected?** Koxudaxi Datamodel-Code-Generator >= 0.9.1, < 0.61.0, >= 0.9.1, <= 0.60.2; datamodel-code-generator (PyPI) ECOSYSTEM:introduced=0.9.1,fixed=0.61.0.

**Is there a fix for CVE-2026-54691?** Yes. datamodel-code-generator (PyPI): upgrade to 0.61.0 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2026-54691 attacked?** It is attacked over the network, in a software library.

**Am I affected by CVE-2026-54691?** Check whether you run Koxudaxi Datamodel-Code-Generator or datamodel-code-generator (PyPI) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## How to fix

- datamodel-code-generator (PyPI): upgrade to 0.61.0 or later

  ```sh
  pip install "datamodel-code-generator>=0.61.0"
  ```


## Technical details

A Server-Side Request Forgery (SSRF) vulnerability exists in the `http.get_body` function within `src/datamodel_code_generator/http.py`. The component uses `httpx.get` with `follow_redirects=True` but fails to validate the host or IP address of the initial URL or any subsequent redirect targets. An attacker can provide a URL that redirects to loopback addresses, RFC1918 private ranges, or cloud metadata services (e.g., 169.254.169.254). Because the tool reflects the response body into the generated Python models as class attributes or docstrings, sensitive data from internal services can be exfiltrated. This issue is fixed in version 0.61.0, which introduces host validation and a new `--allow-private-network` flag for explicit opt-in.

## Affected products

- koxudaxi datamodel-code-generator >= 0.9.1, < 0.61.0

## Identifiers

- CVE-2026-54691
- GHSA-rfr2-mq9m-x2qx
- PYSEC-2026-3564

## Timeline

- 2026-06-08: patched: Fixed in version 0.61.0
- 2026-07-28: advisory: GitHub Advisory GHSA-rfr2-mq9m-x2qx published

## References

- [https://github.com/koxudaxi/datamodel-code-generator/commit/5fdba4a09f2d7a9996a504975b7ef7d63e3715bb](https://github.com/koxudaxi/datamodel-code-generator/commit/5fdba4a09f2d7a9996a504975b7ef7d63e3715bb)
- [https://github.com/koxudaxi/datamodel-code-generator/releases/tag/0.61.0](https://github.com/koxudaxi/datamodel-code-generator/releases/tag/0.61.0)
- [https://github.com/koxudaxi/datamodel-code-generator/security/advisories/GHSA-rfr2-mq9m-x2qx](https://github.com/koxudaxi/datamodel-code-generator/security/advisories/GHSA-rfr2-mq9m-x2qx)

## Related threats

- [datamodel-code-generator Protobuf path traversal allows files to be written outside directory](https://junglewise.ai/threats/cve-2026-107377-datamodel-code-generator-protobuf-weak-import-path-traversal)
- [koxudaxi datamodel-code-generator code injection in generated imports](https://junglewise.ai/threats/cve-2026-55415-koxudaxi-datamodel-code-generator-code-injection-in-generated)
- [koxudaxi datamodel-code-generator credential leak in cross-origin redirects](https://junglewise.ai/threats/cve-2026-55403-koxudaxi-datamodel-code-generator-credential-leak-in-cross-origin)
- [koxudaxi datamodel-code-generator SSRF via DNS rebinding](https://junglewise.ai/threats/cve-2026-55391-koxudaxi-datamodel-code-generator-ssrf-via-dns-rebinding)
- [koxudaxi datamodel-code-generator path traversal in XML Schema parsing](https://junglewise.ai/threats/cve-2026-55390-koxudaxi-datamodel-code-generator-path-traversal-in-xml-schema)
