Skip to main content
VulnerabilityPublished Updated

GitPython: command injection via unguarded Git options in `Repo.archive()`, `git.ls_remote()`, and arbitrary file

Affects GitPythonSource GCVE Database

0

CVSS 8.4 High : upgrade to 3.1.51 soon.

Data as of 26 Oct 2026, 16:10 UTC

CVSS 3.1 base score
8.4High
How severe the flaw is on the 0–10 CVSS scale.
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:H

What to do

Upgrade GitPython to 3.1.51.

Affected software

ProductAffectedFixed in
PyPIGitPythonAffected
  • <3.1.51
Fixed in
  • 3.1.51

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

Community reviews

Loading reviews…