Skip to main content

datamodel-code-generator EUVDEUVD-2026-95134

| CVE-2026-107377 HIGH
Path Traversal (CWE-22)
2026-10-08 GitHub_M GHSA-77xj-x4rm-935c
7.5
CVSS 3.1 · Vendor: GitHub_M
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Craft malicious .proto with weak import path
  2. Delivery
    Victim or CI job processes schema (protobuf input)
  3. Exploit
    WEAK_IMPORT_PATTERN captures ../ or absolute path
  4. Execution
    _write_missing_weak_imports escapes temp dir
  5. Impact
    Create/overwrite writable files with syntax stub

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A01:2025 - Broken Access Control
ASVS 5.0
V5 - File Handling Path canonicalization, traversal prevention
MITRE ATT&CK

2 techniques across 2 tactics: Discovery, Collection

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Exploitation Conditions

Requires the victim to invoke datamodel-code-generator with --input-file-type protobuf on an attacker-controlled .proto supplied locally (--input) or remotely (--url), and the grpcio-tools package must be installed to enable Protobuf input support. The malicious schema must contain a weak import whose path is absolute or uses .. to escape the __weak_imports__ temporary directory. Limiting factors: exploitation is bounded to creating files/directories or overwriting files writable by the running process; file contents cannot be attacker-controlled (only a proto2/proto3 syntax declaration is written); relative-path overwrite of existing files is possible because the existence check and stub write used different base directories, while an existing absolute target is skipped. The effect persists even when later protoc compilation fails. Only versions 0.59.0 through 0.80.0 are affected.

Impact

Signals are consistent but point to a moderate, not critical, priority. The NVD CVSS 3.1 vector (AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N, 7.5) rates this as a high-severity integrity-only flaw, but that vector understates two real limits that the description makes explicit: exploitation requires a victim or automated job to actively process an attacker-controlled Protobuf schema (an action the base vector encodes as UI:N but which in practice is user/CI-driven), and the written content is NOT attacker-controlled - only a fixed syntax = "proto2";/syntax = "proto3"; declaration. The vendor advisory explicitly states direct arbitrary code execution has NOT been demonstrated, which directly contradicts the input 'RCE' tag - treat that tag as inaccurate. No EPSS score, no CISA KEV listing, and no exploitation-in-the-wild evidence were provided, so exploitation status rests only on the GHSA's described proof-of-concept. SSVC-style framing: exploitation is proof-of-concept only, automatable is partly true (any CI job auto-processing untrusted .proto files is exposed), but technical impact is partial given the constrained write primitive. Net: a genuine path-traversal file-write affecting dev/CI pipelines that handle untrusted protobuf schemas, worth patching promptly, but it is a high-CVSS-but-bounded-impact issue rather than an urgent mass-exploitation threat.

Exploit ScenarioDerived

A developer or CI pipeline uses datamodel-code-generator with --input-file-type protobuf (grpcio-tools installed) to generate models from a .proto file sourced from an untrusted repository or fetched via --url. The attacker embeds a weak import with an absolute or ../-laden path; when the schema is processed, the tool writes a Protobuf syntax stub outside the intended __weak_imports__ temp directory, creating new directories/files or overwriting an existing writable file. A proof-of-concept is described in the GHSA advisory, and the file-write side effect persists even after the subsequent protoc compilation fails.

This Week Schedule remediation this week. Why: HIGH severity (CVSS 7.0-8.9).
1 PoC candidate (unverified) Patch available 0.5% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Oct 08, 2026

Processing an attacker-controlled Protobuf schema with datamodel-code-generator 0.59.0 through 0.80.0 lets a crafted weak-import path escape the __weak_imports__ temporary directory, creating directory trees and new files, or overwriting existing files that are writable by the running process (assessed as CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:L/A:N; the vendor-reported vector is 7.5 with a higher integrity rating). Exploitation requires a victim or automated CI job to invoke the tool with --input-file-type protobuf on a malicious .proto supplied locally via --input or remotely via --url, and the grpcio-tools package must be installed to enable Protobuf input support; the payload is limited to a syntax = "proto2"; or syntax = "proto3"; declaration, so fully attacker-controlled content and direct arbitrary code execution have not been demonstrated. No active exploitation is confirmed (not in CISA KEV), though the upstream GitHub advisory carries a proof-of-concept and technical write-up, and the fix ships in version 0.81.0.

RemediationAI

Upgrade to datamodel-code-generator 0.81.0 or later, which is the vendor-released patch containing the upstream fix (commit 5e94b8f4203198798ec66b8e48217f70af69a0dc) that resolves the weak-import directory and rejects any stub path not contained within it, and that also cleans up the temporary directory when preparer setup fails; the GHSA advisory at https://github.com/datamodel-code-generator/datamodel-code-generator/security/advisories/GHSA-77xj-x4rm-935c and the 0.81.0 release notes should be used to track the change. If an immediate upgrade is not possible, the most effective compensating control is to stop feeding untrusted Protobuf schemas into the tool: do not run --input-file-type protobuf (or the equivalent Python API) against .proto files from third parties, and in particular avoid --url against untrusted hosts, accepting that legitimate schema-conversion workflows from external sources will break. Removing or not installing grpcio-tools in the runtime environment disables the Protobuf input path entirely and eliminates the vulnerable sink, at the cost of losing Protobuf support; this is a clean, verifiable toggle for CI images. Where Protobuf processing must continue, run generation inside an ephemeral, least-privilege container or sandbox whose only writable location is a scratch directory the process owns, mount source checkouts and build outputs read-only, and run as a non-privileged user so that absolute-path writes are confined and relative .. traversal cannot reach sensitive files; note this does not prevent writes inside the sandbox and adds operational overhead. Finally, treat any CI job that consumes externally contributed .proto files as untrusted input and monitor for unexpected syntax = "proto2";/syntax = "proto3"; content appearing in files outside the temporary build area, since the written payload is narrow enough that such artifacts are a reliable detection signal.

Affected VersionsENISA

datamodel-code-generator 0.59.0, < 0.81.0

Affected Packages

pypi datamodel-code-generator fix: 0.81.0

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 1 package in pypi

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

datamodel-code-generator is a Python tool that generates Pydantic, dataclass, TypedDict and similar models from schema formats including OpenAPI, JSON Schema and Protobuf. The vulnerable code path lives in src/datamodel_code_generator/parser/protobuf.py: the WEAK_IMPORT_PATTERN regular expression at line 37 captures the path supplied on a protobuf import weak "..." statement, and _write_missing_weak_imports (around lines 391-393) joins that captured value onto the per-run temporary directory using weak_import_dir / import_path, then calls mkdir(parents=True) and write_text. Because the captured value was never validated, an absolute path or a relative path containing .. would resolve outside the intended temp_path / "__weak_imports__" sandbox - the classic CWE-22 improper limitation of a pathname to a restricted directory. The write happens inside _ProtoInputPreparer.__enter__ (line 333), i.e. before protoc.main(...) is invoked, so the filesystem side effects persist even if the subsequent compilation fails, and the temporary directory was likewise not cleaned up on that early exception. A further defect compounded the impact: the existence check and the stub write used different base directories, which allowed relative traversal to overwrite existing writable files, whereas an existing absolute target was skipped by the existence check alone. The upstream fix (commit 5e94b8f) resolves weak_import_dir once, resolves each candidate stub path, and rejects any path that is not is_relative_to(weak_import_dir) by raising SchemaParseError("Invalid Protocol Buffers weak import path: ..."), plus wraps the preparer setup in try/except so the temporary directory is cleaned up on failure. The new regression test test_protobuf_weak_import_cannot_escape_temporary_directory exercises both the absolute and ../../ variants.

Know when Python gets its next vulnerability

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (GitHub_M) PRIMARY 7.5 HIGH
AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N
vuln.today AI 4.3 MEDIUM

A victim/CI job must process the malicious schema (UI:R); impact is integrity-only and limited to a fixed non-attacker-controlled syntax-declaration write (I:L), with no confidentiality or availability loss.

3.1 AV:N/AC:L/PR:N/UI:R/S:U/C:N/I:L/A:N
4.0 AV:N/AC:L/AT:N/PR:N/UI:P/VC:N/VI:L/VA:N/SC:N/SI:N/SA:N

Primary rating from Vendor (GitHub_M).

CVSS VectorVendor: GitHub_M

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
None
Scope
Unchanged
Confidentiality
None
Integrity
High
Availability
None

Lifecycle Timeline

2
Patch available
Oct 08, 2026 - 19:18 EUVD
CVE Published
Oct 08, 2026 - 17:55 cve.org
HIGH 7.5

DescriptionCVE.org

datamodel-code-generator generates Python data models from schema definitions. From 0.59.0 until 0.81.0, an attacker-controlled Protobuf schema can supply absolute or parent-directory paths captured by WEAK_IMPORT_PATTERN and consumed by _write_missing_weak_imports in src/datamodel_code_generator/parser/protobuf.py. Exploitation requires a victim or automated job to process the attacker-controlled schema with Protobuf input support, which requires the grpcio-tools package. The paths escape the weak_imports temporary directory before protoc runs, allowing creation of directory trees and new files or overwrite of existing writable files with a generated Protobuf syntax declaration. The effect persists when later Protobuf compilation fails. The written content is limited to a proto2 or proto3 syntax declaration, and direct arbitrary code execution has not been demonstrated. This issue is fixed in version 0.81.0.

Technical POC Analysis

CWE-22 (with the advisory also tagging CWE-73).

Full technical POC analysis - root cause, step-by-step exploitation and patch breakdown - is part of the Pro and Business plans.

Latest POC

1 PoC candidate from github (unverified)

Sign in to open the public PoC links collected for this CVE.

Executive ViewAI

Why It Matters

datamodel-code-generator versions 0.59.0 through 0.80.0, an open-source code generation utility embedded in many developer workflows and CI pipelines, can be induced to create or overwrite files outside its intended temporary directory when it processes a maliciously crafted Protobuf schema, using only the privileges of the developer or build job that invokes it. Because no vendor patch exists and the tool is typically run with write access to working directories and build workspaces, the practical risk is silent tampering with build inputs, generated artifacts, or checked-in files rather than direct system compromise. Leadership should care because this sits in the software supply chain path that produces code, and the affected component may be present across many repositories and pipeline images without a clear owner.

Business Impact: High
Compensating Controls

No vendor-released patch identified at time of analysis. Interim mitigations: remove or pin datamodel-code-generator outside the 0.59.0-0.80.0 range, uninstall grpcio-tools where Protobuf input is not needed (the vulnerable path requires it), refuse untrusted .proto files supplied via --input or --url, and run any required generation in a sandboxed non-root container with read-only mounts, no repository write access, and no credentials.

Threat Intelligence Overview

EPSS Score
0.5%
Top 63% exploitable
Prevalence
Medium
popular Python model-generation library, but vulnerable protobuf path is a niche feature
Threat Intel
1
1 source
Data Quality
5 sources
Confidence: Medium

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity HIGH
CISA KEV No
Public POC Yes
EPSS 0.5%
Patch available Yes
Active threat No
Deciding rule
HIGH severity (CVSS 7.0-8.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision· derived
Scheduled
Exploitation· derived
Poc
System Exposure· derived
Open
Automatable· derived
Yes
Human Impact
High

Priority Score

58
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +38
PoC: +20
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Path traversal exploits occur when applications use user-controlled input to construct file system paths without proper validation.

More in Python

View all
CVE-2025-24016 CRITICAL POC
9.9 Feb 10

Wazuh SIEM platform versions 4.4.0 through 4.9.0 contain an unsafe deserialization vulnerability in the DistributedAPI t

CVE-2025-27520 CRITICAL POC
9.8 Apr 04

BentoML version 1.4.2 and earlier contains an unauthenticated remote code execution vulnerability through insecure deser

CVE-2025-2945 CRITICAL POC
9.9 Apr 03

pgAdmin 4 contains critical remote code execution vulnerabilities in the Query Tool download and Cloud Deployment endpoi

CVE-2013-5093 MEDIUM POC
6.8 Sep 27

The renderLocalView function in render/views.py in graphite-web in Graphite 0.9.5 through 0.9.10 uses the pickle Python

CVE-2025-32375 CRITICAL POC
9.8 Apr 09

BentoML is a Python library for building online serving systems optimized for AI apps and model inference. Rated critica

CVE-2014-0224 HIGH POC
7.4 Jun 05

OpenSSL before 0.9.8za, 1.0.0 before 1.0.0m, and 1.0.1 before 1.0.1h does not properly restrict processing of ChangeCiph

CVE-2024-21644 HIGH POC
7.5 Jan 08

pyLoad download manager version prior to 0.5.0b3.dev77 exposes the Flask SECRET_KEY through an unauthenticated endpoint.

CVE-2026-33017 CRITICAL POC
9.3 Mar 17

Langflow (a visual LLM pipeline builder) contains a critical unauthenticated code execution vulnerability (CVE-2026-3301

CVE-2017-9462 HIGH POC
8.8 Jun 06

In Mercurial before 4.1.3, "hg serve --stdio" allows remote authenticated users to launch the Python debugger, and conse

CVE-2026-49869 CRITICAL POC
10.0 Jun 26

Unauthenticated remote code execution affects Kestra OSS (the open-source event-driven orchestration platform) prior to

CVE-2026-39987 CRITICAL POC
9.3 Apr 08

Unauthenticated remote code execution in Marimo ≤0.20.4 allows attackers to execute arbitrary system commands via the `/

CVE-2024-21645 MEDIUM POC
5.3 Jan 08

pyLoad is the free and open-source Download Manager written in pure Python. Rated medium severity (CVSS 5.3), this vulne

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy