GitPython: arbitrary file read via attacker-controlled branch name in `Head.checkout()` (incomplete fix of
Affects GitPythonSource GCVE Database
Mentioned vulnerabilities
CVSS 7.1 High : upgrade to 3.2.0 soon.
Data as of 27 Oct 2026, 17:27 UTC
- Patch
- Available – fixed in 3.2.0
CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:N/VI:H/VA:N/SC:N/SI:N/SA:NWhat to do
Upgrade GitPython to 3.2.0.
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
Upgrade GitPython to version 3.2.0 or later, where this vulnerability is fixed. The fix properly sanitizes the positional branch name argument in Head.checkout(). Until upgrading, avoid cloning and checking out untrusted repositories using vulnerable GitPython versions. No other mitigations are documented by the vendor.
Description
GitPython versions up to 3.1.62 contain a vulnerability in the Head.checkout() method that allows an attacker to cause an arbitrary file read via a specially crafted branch name. The flaw arises because the positional branch name argument is not properly sanitized and is passed directly to the git checkout command without a separator, enabling injection of options such as --pathspec-from-file to read files like /etc/passwd. This issue is an incomplete fix of previous advisories and affects all published releases up to 3.1.62. A fix is available in version 3.2.0.
References
- github.com/gitpython-developers/GitPython/security/advisories/GHSA-23mf-xhv8-69c2 (opens in a new tab)
- github.com/gitpython-developers/GitPython/pull/2233 (opens in a new tab)
- github.com/gitpython-developers/GitPython/commit/8da65080849a56a2fc9f3e7817bbf0524e8397d5 (opens in a new tab)
- github.com/gitpython-developers/GitPython (opens in a new tab)
- github.com/gitpython-developers/GitPython/releases/tag/3.2.0 (opens in a new tab)