Impact
A path traversal flaw in Dulwich’s porcelain.submodule_update, and by extension porcelain.clone with recurse_submodules enabled, allows an attacker to supply a crafted .gitmodules file and matching tree gitlink that points to ".git/hooks" or another directory inside the parent repository’s .git folder. The flaw causes the submodule’s content to be written directly into the victim’s .git/hooks directory with executable permissions. Subsequent Git or Dulwich commands that trigger the hook run the attacker’s code, resulting in arbitrary code execution. The vulnerability is identified as CWE‑22 and carries a CVSS score of 7.5.
Affected Systems
The software vendor Jelmer publishes Dulwich, a pure‑Python implementation of Git. Versions from 0.23.2 through 1.2.4 are affected; the issue is fixed in Dulwich 1.2.5. Any system or service using a vulnerable Dulwich library and performing a clone or submodule update that pulls from a malicious upstream repository is at risk.
Risk and Exploitability
Attackers need to provide a malicious upstream repository containing a valid .gitmodules entry and a gitlink tree object whose path is .git/hooks. The exploit occurs when a victim runs dulwich.porcelain.clone with recurse_submodules=True or calls submodule_update, which materializes the payload into the hooks directory. No elevated privileges are required to trigger the attack; the malicious code runs with the permissions of the process executing the Git command. The EPSS score is not available and the vulnerability is not listed in CISA’s KEV catalog, but the high CVSS score and the ease of construction of a malicious repository suggest a non‑negligible risk of exploitation.
OpenCVE Enrichment