CVE-2026-107377: datamodel-code-generator: Protobuf weak-import path traversal allows files to be written outside the temporary directory
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 →