Pypi · Gitpython · CVE-2026-67323
**Name of the Vulnerable Software and Affected Versions**
GitPython versions prior to 3.1.51
**Description**
GitPython fails to properly sanitize arguments passed to several public APIs, allowing for command injection and arbitrary file manipulation. The issue occurs because the software does not enforce safety checks on Git options for certain methods, enabling attackers to inject dangerous flags into the underlying `git` binary calls.
Technical details include:
- Command Execution: The `Repo.archive()` method forwards `**kwargs` verbatim, and the `git.ls remote()` method allows the `upload pack` keyword argument to be passed without validation. An attacker can use options such as `--exec` or `--upload-pack` to execute arbitrary commands on the host system.
- Arbitrary File Overwrite: The `Repo.iter commits()` and `Repo.blame()` methods do not check for leading dashes in the `rev` argument. By passing a value like `--output=<path>`, an attacker can cause Git to open and truncate an arbitrary file on the system.
Exploitation requires an application to pass attacker-controlled arguments to these specific methods.
**Recommendations**
Update GitPython to version 3.1.51 or later.
As a temporary mitigation, restrict or disable the use of the `Repo.archive()`, `git.ls remote()`, `Repo.iter commits()`, and `Repo.blame()` methods if they process untrusted user input.