Intel

AIKIDO-2025-10394

datamodel-code-generator is vulnerable to Code Injection

Code Injection Pre-CVE
Found by Aikido Intel before public disclosure or CVE publication.
Published Jun 23, 2025

69

Medium Risk

This Affects:

PYTHONdatamodel-code-generator
0.17.2 - 0.31.1
Fixed in 0.31.2
Are you affected? Scan for Free

TL;DR

Affected versions of the package are vulnerable to Code Injection due to improper handling of newline characters during file generation from headers. Malicious input hiding behind newlines can break the intended structure of the generated code and allow attackers to inject arbitrary code.

Who does this affect?

You are affected if you are using a version that falls within the vulnerable range.

Background info

datamodel-code-generator is vulnerable to Code Injection in versions 0.17.2 - 0.31.1.

How to fix this

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