Impact
GitPython versions prior to 3.1.58 contain a vulnerability in the Repo.init function that forwards git options without validation. By providing a template parameter that points to a directory containing malicious git hooks, an attacker can cause those hooks to execute when subsequent git operations are performed on the initialized repository, leading to arbitrary code execution with the privileges of the running process.
Affected Systems
All versions of the GitPython library distributed by gitpython‑developers before 3.1.58 are affected. The library is commonly embedded in Python applications that interact with Git repositories. Any deployment that invokes Repo.init with a template parameter that can be influenced by untrusted input could be vulnerable.
Risk and Exploitability
The flaw has a CVSS score of 7.7, indicating high severity, but the EPSS score of < 1% suggests a very low probability of exploitation. It is not listed in the CISA KEV catalog. The attack requires the ability to control the template parameter supplied to Repo.init, which typically means the attacker can influence code that runs within the affected application; this is inferred from the description since the exact attack vector is not explicitly stated. Once a malicious template with hooks is provided, those hooks run during subsequent git commands, giving the attacker full execution rights on the host. The vulnerability could be exploited remotely by delivering a specially crafted repository or by affecting privileged code that calls Repo.init, although no known exploits are public.
OpenCVE Enrichment
Github GHSA