GitPython: command injection via unguarded Git options in `Repo.archive()`, `git.ls_remote()`, and arbitrary file
Affects GitPythonSource GCVE Database
CVSS 8.4 High : upgrade to 3.1.51 soon.
Data as of 26 Oct 2026, 16:10 UTC
- Patch
- Available – fixed in 3.1.51
CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:HWhat to do
Upgrade GitPython to 3.1.51.
Affected software
| Product | Affected | Fixed in |
|---|---|---|
| PyPIGitPython | Affected
| Fixed in
|
Check your own hosts for these packages with threat-finder (opens in a new tab), our free open-source scanner.
AI-suggested
If you cannot patch yet, avoid passing untrusted or user-controlled inputs to `Repo.archive()`, `git.ls_remote()`, `Repo.iter_commits()`, and `Repo.blame()`. Restrict usage of these APIs to trusted inputs only.
Description
GitPython versions prior to 3.1.51 contain multiple vulnerabilities due to insufficient validation of caller-supplied options in several public APIs. Specifically, `Repo.archive()` and `git.ls_remote()` allow arbitrary command execution by forwarding unsafe Git options without proper checks. Additionally, `Repo.iter_commits()` and `Repo.blame()` permit arbitrary file overwrite by placing unvalidated revision arguments before the end-of-options separator, enabling file truncation. These issues arise because the existing unsafe option checks are only applied to network commands and not extended to these other APIs.
References
- github.com/gitpython-developers/GitPython/security/advisories/GHSA-956x-8gvw-wg5v (opens in a new tab)
- github.com/gitpython-developers/GitPython/pull/2163 (opens in a new tab)
- github.com/gitpython-developers/GitPython/commit/701ce32fe5ba8cb622c0e0342a376a6beb47d738 (opens in a new tab)
- github.com/gitpython-developers/GitPython (opens in a new tab)
- github.com/gitpython-developers/GitPython/releases/tag/3.1.51 (opens in a new tab)
- nvd.nist.gov/vuln/detail/CVE-2026-67323 (opens in a new tab)
- vulncheck.com/advisories/gitpython-before-command-injection-via-unguarded-git-options (opens in a new tab)