Arbitrary Code Injection Affecting datamodel-code-generator package, versions [,0.31.2)


Severity

Recommended
0.0
medium
0
10

CVSS assessment by Snyk's Security Team. Learn more

Do your applications use this vulnerable package?

In a few clicks we can analyze your entire application and see what components are vulnerable in your application, and suggest you quick fixes.

Test your applications

Snyk Learn

Learn about Arbitrary Code Injection vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-PYTHON-DATAMODELCODEGENERATOR-14829603
  • published1 Jan 2026
  • disclosed1 Jan 2026
  • creditUnknown

Introduced: 1 Jan 2026

CVE NOT AVAILABLE CWE-94  (opens in a new tab)

How to fix?

Upgrade datamodel-code-generator to version 0.31.2 or higher.

Overview

datamodel-code-generator is a Datamodel Code Generator

Affected versions of this package are vulnerable to Arbitrary Code Injection due to improper sanitization of filenames used in generated headers. An attacker can provide a maliciously crafted filename containing Python syntax or escape characters.

References

CVSS Base Scores

version 4.0
version 3.1