Advisory Database
  • Advisories
  • Dependency Scanning
  1. pypi
  2. ›
  3. datamodel-code-generator
  4. ›
  5. CVE-2026-107377

CVE-2026-107377: datamodel-code-generator: Protobuf weak-import path traversal allows files to be written outside the temporary directory

October 8, 2026

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. Absolute import paths and relative paths containing .. could escape this directory.

An attacker could create directories and new files at locations writable by the process. Relative path traversal could also overwrite existing writable files because the existence check and the stub write used different base directories. An existing absolute target was skipped by the existence check.

Written content was limited to a generated Protobuf syntax declaration, syntax = "proto2"; or syntax = "proto3";, followed by a newline. This issue did not provide fully attacker-controlled file contents, and direct arbitrary code execution has not been demonstrated.

These filesystem side effects occurred before protoc ran. A subsequent compilation error did not undo them. A user or CI job must process the attacker-controlled schema for the issue to be triggered, whether the schema is supplied as a local file or fetched via --url.

References

  • github.com/advisories/GHSA-77xj-x4rm-935c
  • github.com/datamodel-code-generator/datamodel-code-generator/commit/5e94b8f4203198798ec66b8e48217f70af69a0dc
  • github.com/datamodel-code-generator/datamodel-code-generator/releases/tag/0.81.0
  • github.com/datamodel-code-generator/datamodel-code-generator/security/advisories/GHSA-77xj-x4rm-935c
  • nvd.nist.gov/vuln/detail/CVE-2026-107377

Code Behaviors & Features

Detect and mitigate CVE-2026-107377 with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Dependency Scanning using SBOM also detects vulnerabilities from proprietary advisories that this site does not include. Learn more about Dependency Scanning using SBOM →

Affected versions

All versions starting from 0.59.0 before 0.81.0

Fixed versions

  • 0.81.0

Solution

Upgrade to version 0.81.0 or above.

Impact 7.5 HIGH

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

Learn more about CVSS

Weakness

  • CWE-22: Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal')
  • CWE-73: External Control of File Name or Path

Source file

pypi/datamodel-code-generator/CVE-2026-107377.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Sun, 08 Nov 2026 00:17:08 +0000.