SSRF in datamodel-code-generator http.get_body
CVE-2026-54691 is a server-side request forgery vulnerability in datamodel-code-generator, a tool that generates Python data models from schema definitions. Affected versions from 0.9.1 through 0.60.x accept user-supplied --url targets in src/datamodel_code_generator/http.py via the http.get_body function without sufficient host or IP validation. The vulnerable logic also follows redirect chains without validating the final destination. As a result, an attacker can cause the application to issue requests to loopback, private, link-local, metadata, and other network-reachable resources that should not be accessible through externally influenced URL fetching. The flaw is fixed in version 0.61.0.
What it means and what to do now: patch path, interim mitigations, and the assume-compromise checklist.
What an attacker gets, and what they’ve been doing with it.
Successful exploitation allows an attacker to induce datamodel-code-generator to retrieve data from internal or otherwise non-public network locations. This can expose sensitive information such as internal service responses or cloud instance metadata and may cause the fetched content to be incorporated into generated Python source output. The issue primarily affects confidentiality, with some integrity impact possible through attacker-controlled remote content influencing generated artifacts. No direct availability impact is indicated by the available information.
If you can’t patch tonight, do this now.
Do not allow untrusted or insufficiently validated input to control the --url option. Avoid enabling remote schema fetching where it is not operationally necessary, and avoid using the HTTP-fetching functionality in environments that can reach sensitive internal services or metadata endpoints. If remote retrieval is required before patching, enforce strict outbound network filtering, manually validate allowed destinations, and isolate execution from internal networks and cloud metadata services.
Patch, then assume compromise.
Upgrade datamodel-code-generator to version 0.61.0 or later. The fix adds validation for HTTP(S) URL targets, blocks non-public network destinations by default, validates redirect targets, and changes redirect handling so that automatic redirect following is not permitted unless explicitly allowed. Where trusted internal endpoints are required, use the explicit opt-in mechanism introduced by the fixed release.
No public exploits tracked yet. Mallory keeps watching.
3 sources tracked across advisories, community write-ups, and news. New activity surfaces here as Mallory finds it.