Skip to main content
VulnerabilityPublished Updated

CVE-2026-76217: GitPython · Arbitrary file read via --pathspec-from-file in IndexFile.remove() and Head.checkout()

Affects GitPythonSource GCVE Database

0

Mentioned vulnerabilities

CVSS 6.5 Medium : upgrade to 3.1.58 when convenient.

Data as of 26 Oct 2026, 16:15 UTC

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

What to do

Upgrade GitPython to 3.1.58.

Affected software

ProductAffectedFixed in
PyPIGitPythonAffected
  • <3.1.58
Fixed in
  • 3.1.58

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

Community reviews

Loading reviews…