CVE-2026-76217: GitPython before 3.1.58 Arbitrary File Read via pathspec-from-file
GitPython versions before 3.1.58 fail to validate options passed to git rm and git checkout commands in IndexFile.remove() and Head.checkout(). Attackers can supply --pathspec-from-file and --pathspec-file-nul parameters to read arbitrary files accessible to the process, with full file contents returned in GitCommandError.stderr.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
gitpythonto a version that resolves this vulnerability.Fixed in 3.1.58
Event History
Frequently Asked Questions
What access does an attacker need to exploit this issue?
The attacker needs the ability to supply options that reach GitPython's IndexFile.remove() or Head.checkout() methods. No user interaction is required, but the affected process must be able to read the target file.
What information could be exposed?
An attacker can read arbitrary files accessible to the process running GitPython. The file contents are returned in the stderr field of a GitCommandError.
Which GitPython versions should be remediated?
GitPython versions before 3.1.58 are affected. Upgrade to version 3.1.58 or later.
What can be done if an immediate upgrade is not possible?
Prevent untrusted input from controlling arguments passed to IndexFile.remove() or Head.checkout(), particularly the --pathspec-from-file and --pathspec-file-nul options. Run the affected process with least-privilege filesystem access to limit readable files.