datamodel-code-generator: Protobuf weak-import path traversal allows files to be written outside the temporary directory (CVE-2026-107377)
Description
A path traversal vulnerability in datamodel-code-generator versions >=0.59.0 and <0.81.0 allows attacker-controlled Protobuf schemas to write files outside the intended temporary directory. The vulnerability arises from improper handling of absolute and relative import paths in weak-import stubs, enabling creation or overwriting of files in writable locations. The written content is limited to a fixed Protobuf syntax declaration, and no direct arbitrary code execution has been demonstrated. The issue occurs before the Protobuf compiler runs and is triggered when processing attacker-controlled schemas via local files or URLs. A fix has been merged but no patched package release is yet available.
CVSS v3.1
Score 7.5high
Affected software
Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
The datamodel-code-generator tool, when processing Protobuf schemas with weak imports, fails to properly validate import paths. Specifically, absolute paths or relative paths containing '..' can escape the designated '__weak_imports__' temporary directory. This allows an attacker supplying a malicious schema to cause the tool to create directories and write files at arbitrary writable locations on the filesystem. The written files contain only a fixed Protobuf syntax declaration line. The vulnerability affects versions >=0.59.0 and <0.81.0. The issue is triggered before the Protobuf compiler runs and requires the victim to run the tool on the attacker-controlled schema. A patch has been merged into the main branch but no official release with the fix is available yet.
Potential Impact
An attacker can cause the tool to write files outside the intended temporary directory, potentially creating new directories and overwriting existing writable files. While the file contents are limited and do not allow direct arbitrary code execution, the integrity of files can be compromised. This could disrupt build processes or cause other integrity-related issues. The vulnerability does not impact confidentiality or availability directly but poses a high integrity risk.
Mitigation Recommendations
A fix has been merged into the main branch of the datamodel-code-generator repository. Users should update to a patched version once it is officially released. Until then, avoid processing untrusted Protobuf schemas with the affected versions (>=0.59.0 <0.81.0). The vendor advisory confirms a patch is available but no release yet. No alternative mitigations are provided.
Technical Details
- Gcve Source
- db.gcve.eu
- Osv Id
- GHSA-77xj-x4rm-935c
- Osv Schema Version
- 1.4.0
- Aliases
- ["CVE-2026-107377"]
- Ecosystems
- ["PyPI"]
- Database Specific Severity
- HIGH
- Cvss Version
- 3.1
Threat ID: 6ac80fb42cdf04f65639a8a9
Added to database: 10/08/2026, 21:48:36 UTC
Last enriched: 10/08/2026, 22:10:30 UTC
Last updated: 10/08/2026, 22:10:30 UTC
Views: 6
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.