Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessCraft malicious .proto with weak import path
-
DeliveryVictim or CI job processes schema (protobuf input)
-
ExploitWEAK_IMPORT_PATTERN captures ../ or absolute path
-
Execution_write_missing_weak_imports escapes temp dir
-
ImpactCreate/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 |
| 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 |
| Exploit ScenarioDerived | A developer or CI pipeline uses datamodel-code-generator with |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – 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
Affected Packages
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
AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N
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.
Primary rating from Vendor (GitHub_M).
CVSS VectorVendor: GitHub_M
Lifecycle Timeline
2DescriptionCVE.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.
Articles & Coverage 1
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
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.
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
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.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
Path traversal exploits occur when applications use user-controlled input to construct file system paths without proper validation.
Wazuh SIEM platform versions 4.4.0 through 4.9.0 contain an unsafe deserialization vulnerability in the DistributedAPI t
BentoML version 1.4.2 and earlier contains an unauthenticated remote code execution vulnerability through insecure deser
pgAdmin 4 contains critical remote code execution vulnerabilities in the Query Tool download and Cloud Deployment endpoi
The renderLocalView function in render/views.py in graphite-web in Graphite 0.9.5 through 0.9.10 uses the pickle Python
BentoML is a Python library for building online serving systems optimized for AI apps and model inference. Rated critica
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
pyLoad download manager version prior to 0.5.0b3.dev77 exposes the Flask SECRET_KEY through an unauthenticated endpoint.
Langflow (a visual LLM pipeline builder) contains a critical unauthenticated code execution vulnerability (CVE-2026-3301
In Mercurial before 4.1.3, "hg serve --stdio" allows remote authenticated users to launch the Python debugger, and conse
Unauthenticated remote code execution affects Kestra OSS (the open-source event-driven orchestration platform) prior to
Unauthenticated remote code execution in Marimo ≤0.20.4 allows attackers to execute arbitrary system commands via the `/
pyLoad is the free and open-source Download Manager written in pure Python. Rated medium severity (CVSS 5.3), this vulne
EUVD-2026-95134
GHSA-77xj-x4rm-935c
NVD
CVE.org
EPSS
Exploit-DB