Executive brief
GitPython is a popular Python library for interacting with Git repositories. The Repo.blame() method is used to retrieve authorship information for file lines. This vulnerability allows an attacker with the ability to influence revision parameters to read arbitrary files from the system where GitPython runs, bypassing the library's security checks and potentially exposing sensitive configuration files, credentials, or other confidential data.
Technical details
The vulnerability is a classic argument injection (CWE-88) flaw in the unsafe_git_revision_options denylist used to guard git command construction. The denylist only blocks --output and -o options (file WRITE), but omits --contents and -S (file READ) git blame options. When a caller passes a revision value like "--contents=/etc/passwd" to Repo.blame() or Repo.blame_incremental(), the option bypasses the guard check because the canonical option name is not in the denylist. The revision string is placed before the -- separator in the git command, allowing arbitrary file reads. The attacker requires the ability to control the revision parameter (low privilege requirement) and the application must call blame() with untrusted input. GitPython <= 3.1.58 is affected; patched in version 3.1.59.
Affected products
- GitPython GitPython <=3.1.58
Timeline
- 2026-08-25: disclosed: Published in GitHub Advisory Database (GHSA-89ff-m8wv-p99r)
- 2026: patched: GitPython 3.1.59 includes fix to expand denylist
- 2026-09-08: other: GHSA-89ff-m8wv-p99r withdrawn as duplicate of GHSA-5xxx-qhh7-9287