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

- Severity: High 7.5 (CVSS:3.1, scored by GitHub_M) `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.53%, higher than 46% of CVEs (2026-12-01)
- Public exploit code or proof of concept: one link below, marked "exploit"
- Published: 2026-10-08T17:55:22.595Z
- Modified: 2026-10-15T14:56:05.150Z
- Also known as: GHSA-77xj-x4rm-935c, PYSEC-2026-4205
- Weaknesses: CWE-22, CWE-73
- SSVC (CISA-ADP): exploitation poc, automatable yes, technical impact partial
- Assigned by: GitHub_M

## Description

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.

(As written by CVE List.)

## Affected

- datamodel-code-generator datamodel-code-generator: >= 0.59.0, < 0.81.0
- datamodel-code-generator (PyPI): from 0.59.0 before 0.81.0

## Every score

- GitHub_M: CVSS:3.1 7.5 High `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N`
- GitHub: CVSS:3.1 7.5 High `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N`
- PyPA Advisory Database: CVSS:3.1 7.5 High `CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:H/A:N`

## References

- <https://github.com/datamodel-code-generator/datamodel-code-generator/security/advisories/GHSA-77xj-x4rm-935c> (exploit, web)
- <https://github.com/datamodel-code-generator/datamodel-code-generator/commit/5e94b8f4203198798ec66b8e48217f70af69a0dc> (web)
- <https://github.com/datamodel-code-generator/datamodel-code-generator/releases/tag/0.81.0> (web)
- <https://github.com/datamodel-code-generator/datamodel-code-generator> (package)
- <https://pypi.org/project/datamodel-code-generator> (package)
- <https://github.com/advisories/GHSA-77xj-x4rm-935c> (advisory)
- <https://nvd.nist.gov/vuln/detail/CVE-2026-107377> (advisory)

## Sources

- CVE List: [CVE-2026-107377](https://www.cve.org/CVERecord?id=CVE-2026-107377), CVE Terms of Use, modified 2026-10-14
- GitHub Advisory Database: [GHSA-77xj-x4rm-935c](https://github.com/advisories/GHSA-77xj-x4rm-935c), CC-BY-4.0, modified 2026-10-15
- NVD: [CVE-2026-107377](https://nvd.nist.gov/vuln/detail/CVE-2026-107377), Public domain, modified 2026-10-14
- PyPA Advisory Database: [PYSEC-2026-4205](https://osv.dev/vulnerability/PYSEC-2026-4205), CC-BY-4.0, modified 2026-10-15

---

Page: https://cve.day/CVE-2026-107377 · Whole record: https://cve.day/CVE-2026-107377.json · Rebuilt by cve.day 2026-11-25T22:59:43.199Z
