Impact
GitPython versions before 3.1.59 omit protection for the separate_git_dir flag when cloning repositories. When an application passes a custom path for this flag to Repo.clone_from() or Repo.clone(), the library writes repository metadata to that arbitrary location, creating directories outside the intended clone destination. This path traversal flaw can allow an attacker to write hook files or other executable code that may be triggered by the GitPython process, potentially leading to remote code execution. The weakness is a directory traversal (CWE-22) vulnerability that affects confidentiality, integrity, and availability of the hosting system if exploited.
Affected Systems
The vulnerability affects the GitPython library provided by gitpython-developers. Users running any GitPython version older than 3.1.59, especially applications that invoke clone operations with a separate_git_dir argument, are at risk. This includes scripts, CI/CD tools, or services that embed GitPython for repository interactions.
Risk and Exploitability
The CVSS score of 8.7 places the issue in the high severity range. An EPSS score is not available, but the absence of a safety check demonstrates a clear implementation oversight. The vulnerability is not listed in the CISA KEV catalog. Exploitation requires the ability to supply a crafted separate_git_dir argument, which is most relevant to applications that allow user input for clone parameters or operate in an environment where an attacker can influence the argument list. The potential for arbitrary filesystem writes and hook execution means that, if the application runs with elevated privileges, an attacker could run arbitrary code with those rights.
OpenCVE Enrichment
Github GHSA