Executive brief
Dulwich, a Python implementation of the Git file format and protocols, is vulnerable to a path traversal flaw when handling submodules. An attacker can provide a specially crafted repository that, when cloned or updated with submodules enabled, writes malicious executable files into the internal Git configuration directory of the victim's machine. This can lead to full system compromise (Remote Code Execution) when the victim subsequently performs standard Git operations.
Technical details
A path traversal vulnerability exists in `dulwich.porcelain.submodule_update` and `porcelain.clone(recurse_submodules=True)`. The root cause is a lack of validation for the `path` attribute in `.gitmodules` and tree gitlink entries. An attacker can specify a path such as `.git/hooks`, causing Dulwich to materialize the submodule's contents into the parent repository's internal hooks directory while preserving executable bits. When the victim or a Dulwich-based service later triggers a Git hook (e.g., post-checkout, pre-commit), the attacker's payload is executed. This is the Dulwich-specific equivalent of CVE-2024-32002 and CVE-2024-32004. The issue is fixed in version 1.2.5.
Affected products
- jelmer dulwich >= 0.23.2, < 1.2.5
Timeline
- 2026-05-28: disclosed
- 2026-07-02: advisory
- 1.2.5: patched