Path traversal in datamodel-code-generator lets attackers write files
Key facts
- Attack vector
- Network
- Privileges required
- None
- User interaction
- None
- Attack complexity
- Low
- Impact type
- —
- Confidentiality · integrity · availability
- None · High · None
- Fix status
- Fixed
Attack profile from CVSS 3.1 · CNA. Fix status from CNA and GitHub.
Summary
datamodel-code-generator from 0.59.0 before 0.81.0 is affected. Its Protobuf parser accepts absolute or parent-directory paths from weak imports, so writes escape the temporary directory (CWE-22). An attacker who supplies a Protobuf schema can make a victim or automated job process it when grpcio-tools is installed, and can then create files or overwrite writable files with a proto syntax declaration. The written content is limited to that declaration, and direct code execution has not been demonstrated.
Written with Claude Haiku 5.5 from the sources below · 2026-10-29
Description from the CNA
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.
Why it matters now
SSVC decision points
CISA ADP · SSVC 2.0.3
- Exploitation
- Poc
- Automatable
- Yes
- Technical impact
- Partial
The decision (Track, Attend, Act) also depends on your mission and well-being impact; see CISA's SSVC guide.
Affected products
| Vendor | Product | Affected versions | Fixed in | Status | Source |
|---|---|---|---|---|---|
| datamodel-code-generator | datamodel-code-generator | 0.59.0 to before 0.81.0 | 0.81.0 | Patch available | CNA |
| — | datamodel-code-generator (PyPI) | 0.59.0 to before 0.81.0 | 0.81.0 | Patch available | GHSA-77xj-x4rm-935c |
- datamodel-code-generator Vendordatamodel-code-generator Affected 0.59.0 to before 0.81.0 Fixed in 0.81.0 Patch available CNA
- datamodel-code-generator (PyPI) Vendor— Affected 0.59.0 to before 0.81.0 Fixed in 0.81.0 Patch available GHSA-77xj-x4rm-935c
Remediation
Upgrade datamodel-code-generator to version 0.81.0, which fixes this issue.
Written with Claude Haiku 5.5 from the sources below · 2026-10-29
- Fix · CNA datamodel-code-generator (datamodel-code-generator) Fixed in 0.81.0
- Fix · GHSA-77xj-x4rm-935c datamodel-code-generator (PyPI) Fixed in 0.81.0 Advisory →
Timeline
- 2026-10-08 Threatist record created from CVE-2026-107377
- 2026-10-08 Alias added: GHSA-77xj-x4rm-935c
- 2026-10-10 Priority changed: MEDIUM → LOW
- 2026-10-14 CISA SSVC decision points changed
- 2026-10-14 Priority changed: LOW → HIGH
References
Other 4
- https://github.com/datamodel-code-generator/datamodel-code-generator/security/advisories/GHSA-77xj-x4rm-935c
- https://github.com/datamodel-code-generator/datamodel-code-generator/commit/5e94b8f4203198798ec66b8e48217f70af69a0dc
- https://github.com/datamodel-code-generator/datamodel-code-generator/releases/tag/0.81.0
- https://github.com/datamodel-code-generator/datamodel-code-generator
Sources
- CVE-2026-107377 · CVE Program
- CVE-2026-107377 · NVD
- FIRST EPSS
- GHSA-77xj-x4rm-935c · GitHub Advisory Database · CC BY 4.0
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences