CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



CVE-2026-107377

CVE-2026-107377: Arbitrary File Write and Overwrite via Protobuf Weak Import Path Traversal in datamodel-code-generator

Amit Schendel
Amit Schendel
Senior Security Researcher

Oct 8, 2026·5 min read·17 visits

Executive Summary (TL;DR)

Unsafe pathname concatenation using python's pathlib division (/) operator allows unauthenticated remote attackers to write or overwrite files outside the sandbox by supplying a crafted Protobuf schema.

A path traversal vulnerability in datamodel-code-generator allows remote attackers to write or overwrite arbitrary files on the local host filesystem via a manipulated Protobuf schema containing malicious weak import paths.

Vulnerability Overview

datamodel-code-generator is a utility designed to automate the creation of Python data representations. The module supports a broad range of ingestion formats including JSON Schema, OpenAPI, and Protocol Buffers. It translates these schemas into fully structured Pydantic models or dataclasses.

From version 0.59.0 up to 0.80.0, the library exhibits a significant vulnerability within its Protocol Buffer parsing engine. The vulnerability is located inside the file src/datamodel_code_generator/parser/protobuf.py which is responsible for managing missing dependencies during compilation. Unsanitized user inputs processed through this parser can result in severe file system manipulation.

The attack surface is exposed whenever the engine accepts untrusted .proto schemas from external actors. If an ingestion service utilizes this package without robust input filtering, remote attackers can compromise file system integrity. This vulnerability is tracked as CVE-2026-107377 and GHSA-77xj-x4rm-935c.

Root Cause Analysis

The underlying flaw resides in how the ProtobufParser class prepares weak import structures for the Protocol Compiler (protoc). To allow compilation to succeed even when imported models are missing, the parser extracts dependencies declared via import weak statements. It identifies these paths using a regular expression and attempts to generate dummy files within an isolated sandbox.

During file system path generation, the parser leverages Python's pathlib.Path class and its / division operator to concatenate the sandbox path with the extracted import path. However, the parser fails to validate whether the resulting pathname points inside the designated directory boundaries. The division operator behaves unsafely when combined with absolute paths or relative path climbing sequences.

If the import weak statement contains an absolute path, the pathlib engine completely discards the prefix representing the temporary sandbox directory. If the import path contains relative elements such as ../../, the operator appends them literally, allowing the resulting path to climb above the sandbox. The application then automatically invokes mkdir(parents=True, exist_ok=True) and write_text() on the resolved path, leading to arbitrary directory generation and file writes.

Code Analysis

Reviewing the vulnerable code in _write_missing_weak_imports highlights the precise execution path leading to the flaw. The original implementation extracted the matched paths and performed a simple check before creating the stub files.

# Vulnerable implementation snippet
for import_path in WEAK_IMPORT_PATTERN.findall(text):
    if any((include_path / import_path).exists() for include_path in include_paths):
        continue
    stub = self.weak_import_dir / import_path
    stub.parent.mkdir(parents=True, exist_ok=True)
    stub.write_text(syntax, encoding=self.parser.encoding)

In this logic, if import_path contains directory climbing directives, the resulting stub object points to an arbitrary location outside self.weak_import_dir. Additionally, the existing file validation check uses include_path / import_path. Because this check evaluates a different destination than the one actually written to, it fails to flag and prevent the overwrite of sensitive destination targets.

The remediation introduces a defensive check using resolve() alongside is_relative_to(). The resolution step normalizes the relative segments, and the subsequent check guarantees that the path resides strictly inside the temporary workspace.

# Patched implementation snippet
weak_import_dir = self.weak_import_dir.resolve()
for import_path in WEAK_IMPORT_PATTERN.findall(text):
    stub = (weak_import_dir / import_path).resolve()
    if not stub.is_relative_to(weak_import_dir):
        msg = f"Invalid Protocol Buffers weak import path: {import_path!r}"
        raise SchemaParseError(msg)
    # Remaining safe write logic continues...

Exploitation Methodology

An attacker can trigger this vulnerability by submitting a Protocol Buffer schema containing a specifically formatted weak import path. The attack does not require any specialized tools or complex configuration flags. A standard .proto schema file is sufficient to execute the traversal.

syntax = "proto3";
import weak "../../../../tmp/target_configuration.json";
 
message TraversalMessage {
    string payload = 1;
}

When the parser ingests this file, it extracts ../../../../tmp/target_configuration.json and evaluates it against the base directory. The file system creates any intermediate directories that do not exist, and subsequently executes a write command. It populates the targeted file with the text string syntax = "proto3";.

The write operation persists even if the overall compilation fails. Because the parser prepares these dummy files prior to running the actual protoc compiler, any subsequent syntax errors within the schema do not revert the file modification. This behavior allows attackers to manipulate configuration files, overwrite script files, or crash running processes by corrupting their data formats.

Impact Assessment

The direct impact of CVE-2026-107377 is classified as a high integrity compromise. An unauthenticated remote attacker can corrupt or overwrite files across any directory where the process owns write permissions. Since the generator often operates as part of an automated pipeline, it may possess privileges to modify application resources.

While the vulnerability does not directly expose contents of the filesystem, it represents a significant vector for service disruption. By overwriting configuration assets, an attacker can trigger application instability or denial of service. Under specific conditions, writing arbitrary content into executable directories can facilitate remote execution.

The severity of this flaw is compounded by the ease of exploitation. The attack complexity is low, requiring nothing more than a standard schema submission. Systems that process third-party schemas automatically are highly vulnerable to this exploitation strategy.

Remediation and Mitigation

The primary remediation strategy is upgrading datamodel-code-generator to version 0.81.0 or higher. This release integrates the validation checks that prevent paths from escaping the temporary boundary. It also introduces automatic cleanup routines that remove the temporary directory if validation fails during parser execution.

If upgrading is not immediately feasible, teams must implement alternative defensive configurations. Schema ingestion endpoints should be restricted to authenticated users. Input validators should check incoming files for the presence of the import weak directive and block any files containing path traversal sequences.

As a general security practice, running the generator inside an isolated sandbox container minimizes the overall blast radius. Configuring the execution environment with a read-only root file system prevents the parser from writing outside designated workspace folders. These multi-layered boundaries ensure that directory traversal attempts do not affect system resources.

Official Patches

datamodel-code-generatorFix: Prevent path traversal in protobuf parser

Fix Analysis (1)

Technical Appendix

CVSS Score
7.5/ 10
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N

Affected Systems

datamodel-code-generator

Affected Versions Detail

Product
Affected Versions
Fixed Version
datamodel-code-generator
datamodel-code-generator
>= 0.59.0, < 0.81.00.81.0
AttributeDetail
CWE IDCWE-22 / CWE-73
Attack VectorNetwork (AV:N)
CVSS v3.17.5 (High)
ImpactHigh Integrity Compromise (File Overwrite)
Exploit StatusProof of Concept available in tests
KEV StatusNot listed

MITRE ATT&CK Mapping

T1083File and Directory Discovery
Discovery
T1005Data from Local System
Collection
CWE-22
Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')

The software uses external input to construct a pathname that is intended to identify a file or directory that is located underneath a restricted parent directory, but the software does not properly neutralize special elements within the pathname.

Vulnerability Timeline

Security issue addressed in fix commit
2026-09-13
Vulnerability published in GitHub Advisory Database
2026-10-08
CVE-2026-107377 assigned and published in NVD
2026-10-08

References & Sources

  • [1]NVD - CVE-2026-107377
  • [2]GitHub Security Advisory GHSA-77xj-x4rm-935c
  • [3]Official Fix Patch Commit

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•8 minutes ago•GHSA-FMC8-P6Q7-75CC
9.9

GHSA-fmc8-p6q7-75cc: Argument Injection in Canonical LXD Backup Compression Leads to Host Root Code Execution

GHSA-fmc8-p6q7-75cc (associated with CVE-2026-48755) is a critical argument injection vulnerability in Canonical LXD (github.com/canonical/lxd). The vulnerability occurs during instance and storage volume backup operations when processing the user-supplied compression_algorithm configuration parameter. While LXD validates the primary executable token against an allowlist of supported compression binaries, it fails to sanitize or restrict subsequent tokens parsed via shellquote.Split. These additional arguments are passed directly to exec.Command. An authenticated attacker with privileges to trigger backups can inject command-line flags for utilities like zstd to read staged files from a container filesystem and write them to arbitrary paths on the underlying host filesystem, such as /etc/cron.d/, achieving root-level arbitrary code execution on the host.

Amit Schendel
Amit Schendel
1 views•10 min read
•about 1 hour ago•GHSA-PJFF-C2WC-F6JM
9.9

CVE-2026-48769: Arbitrary File Write and Remote Code Execution via Trusted Image Hash in Canonical LXD and Linux Containers Incus

A critical path traversal vulnerability caused by improper input validation (CWE-20) exists in the direct image download handler of Canonical LXD and Linux Containers Incus. When an authenticated user requests an image import using the URL source type, the daemon reads the image fingerprint from an untrusted HTTP response header (`Incus-Image-Hash` or `LXD-Image-Hash`) without validating that it conforms to a SHA-256 format. This unvalidated string is concatenated directly into a filesystem path via `filepath.Join` prior to file creation and cryptographic verification, allowing directory traversal sequences to write arbitrary files on the host filesystem as root.

Alon Barad
Alon Barad
5 views•10 min read
•about 5 hours ago•CVE-2026-9639
6.5

CVE-2026-9639: Authenticated Denial of Service via Nil-Pointer Dereference in Canonical LXD Custom Volume Backup Import

CVE-2026-9639 (GHSA-j93m-3j9p-m5m8) is a null pointer dereference vulnerability in Canonical LXD affecting versions 5.0.0 through 5.21.4 and 6.0 through 6.8. The flaw resides in the (*lxdBackend).CreateCustomVolumeFromBackup method within lxd/storage/backend_lxd.go. An authenticated attacker with the can_create_storage_volumes permission can upload a crafted custom volume backup tarball that omits the expires_at field on a snapshot entry, triggering an unhandled SIGSEGV panic and terminating the LXD daemon.

Amit Schendel
Amit Schendel
6 views•9 min read
•about 6 hours ago•CVE-2026-33050
8.8

CVE-2026-33050: OS Command Injection in GeoNode Vector Upload Handler

An operating system command injection vulnerability (CWE-78) exists in GeoNode versions prior to 5.1.0. The vulnerability occurs in the vector upload processing pipeline when handling user-supplied geospatial files. By supplying a crafted layer name containing shell metacharacters, an authenticated attacker with basic data upload privileges can execute arbitrary commands on the underlying server or container hosting the GeoNode application and Celery worker processes.

Alon Barad
Alon Barad
6 views•9 min read
•about 7 hours ago•CVE-2026-46429
5.5

CVE-2026-46429: Unrestricted File Upload and Validation Bypass in GeoNode

GeoNode versions prior to 5.0.3 contain an unrestricted file upload vulnerability (CWE-434) within the document and dataset ingestion architecture. Authenticated low-privileged users can bypass upload validation via direct REST API interactions, file extension masquerading, metadata mutation via PATCH requests, or malicious archive submissions. This allows attackers to store and serve dangerous file types, alter on-disk file references, or trigger path traversal and resource exhaustion during archive extraction.

Amit Schendel
Amit Schendel
7 views•10 min read
•about 8 hours ago•CVE-2026-55649
6.3

CVE-2026-55649: Stored Cross-Site Scripting in GeoNode Document Metadata Abstract Field

CVE-2026-55649 is a stored Cross-Site Scripting (XSS) vulnerability in GeoNode versions prior to 5.0.3. The flaw exists because document abstract metadata fields are ingested via the metadata management pipeline and stored in the backend database without HTML sanitization or input neutralization. An authenticated attacker with privileges to create or edit document metadata can inject arbitrary HTML and JavaScript payloads into these fields. When another user, such as an administrator, views the affected document page or catalog listing, the unencoded payload is rendered into the Document Object Model (DOM) and executes within the victim's browser session.

Amit Schendel
Amit Schendel
7 views•9 min read