Intel

AIKIDO-2026-971188

datamodel-code-generator is vulnerable to Server-Side Request Forgery (SSRF)

Server-Side Request Forgery (SSRF)CVE-2026-54691 Published 4 days ago

82

High Risk

This Affects:

PYTHONdatamodel-code-generator
0.9.1 - 0.60.2
Fixed in 0.61.0
Are you affected? Scan for Free

TL;DR

The datamodel-code-generator HTTP fetcher loads schemas from URLs passed via --url without validating hosts or redirect targets. With the [http] extra installed, an attacker who can influence the URL can reach loopback, private, link-local, or cloud metadata endpoints and reflect responses into generated Python source. Before the fix, redirects were followed unconditionally and only HTML responses were filtered. The patch validates HTTP(S) URLs, blocks non-public network targets by default, validates each redirect, and requires explicit opt-in for private network access.

Who does this affect?

You are affected if you are using a version that falls within the vulnerable range and have installed the [http] extra.

Background info

datamodel-code-generator is vulnerable to Server-Side Request Forgery (SSRF) in versions 0.9.1 - 0.60.2.

How to fix this

Upgrade the datamodel-code-generator library to the patch version.