Executive brief
Dulwich is a Python library used to interact with Git repositories. A security flaw allows an attacker to execute malicious commands on a user's computer if the user is tricked into merging a specially crafted, untrusted branch. This could lead to a full system compromise, data theft, or unauthorized access to the user's files.
Technical details
A command injection vulnerability exists in Dulwich's `ProcessMergeDriver` due to improper neutralization of shell metacharacters. The component substitutes the file path (placeholder `%P`) from the Git tree directly into a command string executed via `subprocess.run(..., shell=True)`. Because file paths in a Git tree can be controlled by an attacker in a malicious branch, they can inject shell commands (e.g., using semicolons or backticks). Exploitation requires the victim to have a merge driver configured that utilizes the `%P` placeholder and to perform a merge operation on an untrusted branch. The issue is fixed in version 1.2.5 by properly shell-quoting substituted values.
Affected products
- Jelmer Vernooij Dulwich >=0.24.0, <1.2.5
Timeline
- 2026-05-28: patched: Fixed in version 1.2.5
- 2026-05-28: advisory: GitHub Security Advisory GHSA-9277-mp7x-85jf published
- 2026-06-10: disclosed: CVE-2026-42563 published to NVD