CVE-2026-107377: datamodel-code-generator Protobuf Weak-Import Path Traversal Vulnerability

datamodel-code-generator Updated 09 Oct 2026

Summary

08/10/2026
Yes i
High
7.5

CVE-2026-107377: When processing an attacker-controlled Protobuf schema, vulnerable versions of datamodel-code-generator could write a generated weak-import stub outside the intended weak_imports temporary directory. Affects datamodel-code-generator versions >= 0.59.0, < 0.81.0. Fixed in 0.81.0. How to fix ↓

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Upload your dependency manifest or SBOM

Drag & drop your file here or

Java Javascript PHP Python Go Rust Ruby Dart C/C++ Elixir CycloneDX SPDX

Upload a supported dependency manifest or SBOM. No installation or source-code access required.

See supported files and SBOM formats
SBOM sbom.json · bom.json · bom.xml · *.spdx.json · *.cdx.json · *.cdx.xml
Java pom.xml · gradle.lockfile · buildscript-gradle.lockfile
Javascript package-lock.json · yarn.lock · pnpm-lock.yaml
PHP composer.lock
Python poetry.lock · requirements.txt · Pipfile.lock
Go go.mod
Rust Cargo.lock
Ruby Gemfile.lock
Dart pubspec.lock
C/C++ conan.lock
Elixir mix.lock
Enter your work email to receive your report link.

Verify your email to view the full report and start 30 days of continuous monitoring. No credit card required.

Sponsored Devnack Penetration testing for web, API and mobile Manual testing by engineers who build software, not an auditor's checklist. Trusted by teams at Swift and Google Talk to Devnack

Background

datamodel-code-generator is a Python package designed to generate data models from various schema formats, including Protobuf. It simplifies the process of creating data models by automating the generation of code based on schema definitions. However, certain versions of this package are vulnerable to a path traversal issue that allows attackers to manipulate file paths, potentially leading to unauthorized file creation or overwriting.

Vulnerability Detail

The vulnerability arises from the way datamodel-code-generator processes attacker-controlled Protobuf schemas. Specifically, it allows for weak-import stubs to be written outside the intended temporary directory due to improper validation of import paths. Attackers can exploit this by crafting malicious Protobuf files that include absolute paths or relative paths with '..', enabling them to create files or directories in arbitrary locations writable by the process. This could lead to overwriting critical files, resulting in project corruption or denial of service. The vulnerability affects versions up to 0.80.0 and has a CVSS score of 7.5, indicating a high severity level.

How To Fix

Latest published version: 0.86.0 as of 22 Oct 2026

pip install --upgrade "datamodel-code-generator==0.86.0"

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

0.81.0

This is the first release that contains the fix.

pip install --upgrade "datamodel-code-generator==0.81.0"

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Workaround

As a temporary workaround, avoid processing untrusted Protobuf schemas or ensure that any schemas processed are from trusted sources. Additionally, you can implement file system permissions to restrict write access to sensitive directories.

Conclusion

The CVE-2026-107377 vulnerability in the datamodel-code-generator package poses a significant risk due to its potential for path traversal attacks. Users are strongly advised to update to the patched version 0.81.0 to mitigate this risk. Additionally, employing best practices for handling untrusted schemas can further enhance security.

See every vulnerability recorded for datamodel-code-generator →

Share this vulnerability

FAQ

The vulnerability allows for path traversal, enabling attackers to write files outside the intended directory.

Versions up to and including 0.80.0 are affected by this vulnerability.

Attackers can create or overwrite files in arbitrary locations, potentially corrupting projects or causing denial of service.

You can use Vulert to monitor and alert for open-source vulnerabilities in your software. Visit Vulert Scanner to check if your application is affected.

Yes, a patch is available in version 0.81.0 of the datamodel-code-generator package.

Related vulnerabilities

Recent vulnerabilities recorded for datamodel-code-generator.

How To Fix

Latest published version: 0.86.0 as of 22 Oct 2026

pip install --upgrade "datamodel-code-generator==0.86.0"

Upgrading to it may include breaking changes; the version below is the minimum fixed release for this vulnerability.

If you need the minimum change

0.81.0

This is the first release that contains the fix.

pip install --upgrade "datamodel-code-generator==0.81.0"

Tip — Not sure which version your app runs? Vulert can match this fix to it. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback