External Control of File Name or Path Affecting datamodel-code-generator package, versions [0.59.0,0.81.0)


Severity

Recommended
0.0
high
0
10

CVSS assessment by Snyk's Security Team. Learn more

Threat Intelligence

Exploit Maturity
Proof of Concept
EPSS
0.45% (38th percentile)

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 External Control of File Name or Path vulnerabilities in an interactive lesson.

Start learning
  • Snyk IDSNYK-PYTHON-DATAMODELCODEGENERATOR-20574179
  • published8 Oct 2026
  • disclosed8 Oct 2026
  • credit李骏杰(Li Junjie)

Introduced: 8 Oct 2026

NewCVE-2026-107377  (opens in a new tab)
CWE-22  (opens in a new tab)
CWE-73  (opens in a new tab)

How to fix?

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

Overview

datamodel-code-generator is a Datamodel Code Generator

Affected versions of this package are vulnerable to External Control of File Name or Path via the _write_missing_weak_imports method in src/datamodel_code_generator/parser/protobuf.py when processing a Protocol Buffers schema file containing a weak import directive. An attacker who controls the input schema can supply a weak import path containing directory traversal sequences (e.g. ../../) that cause the parser to write arbitrary stub files outside the intended temporary directory, resulting in unauthorized file writes to the filesystem.

CVSS Base Scores

version 4.0
version 3.1