CVE-2026-76217: GitPython · Arbitrary file read via --pathspec-from-file in IndexFile.remove() and Head.checkout()
Affects GitPythonSource GCVE Database
Mentioned vulnerabilities
CVSS 6.5 Medium : upgrade to 3.1.58 when convenient.
Data as of 26 Oct 2026, 16:15 UTC
- Patch
- Available – fixed in 3.1.58
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:NWhat to do
Upgrade GitPython to 3.1.58.
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
A patch is available in GitPython version 3.1.58 that addresses this issue by properly guarding unsafe options in the affected methods. Users should upgrade to version 3.1.58 or later to remediate this vulnerability. Until patched, avoid passing untrusted input to the pathspec_from_file and pathspec_file_nul parameters in IndexFile.remove() and Head.checkout().
Description
GitPython versions prior to 3.1.58 contain a vulnerability in the IndexFile.remove() and Head.checkout() methods. These methods forward arbitrary keyword arguments into git rm and git checkout commands without proper validation. When used with the --pathspec-from-file and --pathspec-file-nul options, this allows an attacker to cause Git to treat the entire contents of a chosen file as a pathspec, leading to the file's contents being leaked in error messages. This results in an arbitrary file read vulnerability disclosed through GitCommandError.stderr.
References
- github.com/gitpython-developers/GitPython/security/advisories/GHSA-hh9p-6wh2-4mfc (opens in a new tab)
- github.com/gitpython-developers/GitPython/pull/2204 (opens in a new tab)
- github.com/gitpython-developers/GitPython/commit/f2550b65bf60ca087190981e2c7b6865e201f40c (opens in a new tab)
- github.com/gitpython-developers/GitPython (opens in a new tab)
- github.com/gitpython-developers/GitPython/releases/tag/3.1.58 (opens in a new tab)
- nvd.nist.gov/vuln/detail/CVE-2026-76217 (opens in a new tab)
- vulncheck.com/advisories/gitpython-before-arbitrary-file-read-via-pathspec-from-file (opens in a new tab)