7.1high
GitPython before 3.1.59 Arbitrary File Read via Repo.blame()
- Severity
- 7.1high CVSS:4.0 by VulnCheck
- Exploit likelihood
- 0.30% (higher than 24% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- VulnCheck
- Also known as
- GHSA-5xxx-qhh7-9287PYSEC-2026-3788
Description
GitPython versions before 3.1.59 contain an incomplete denylist in the unsafe_git_revision_options guard that omits --contents and -S options, allowing attackers to read arbitrary files by passing these options to Repo.blame(). Attackers can supply revision values like --contents=/etc/passwd to leak file contents through the blame result returned to the caller.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| gitpython-developers GitPython | before 3.1.59 Not affected: 3.1.59 | CVE List |
| gitpython (PyPI) | before 3.1.59 | GitHub Advisory Database, PyPA Advisory Database |
| gitpython_project gitpython | before 3.1.59 | NVD |
All scores
| VulnCheck | 7.1high CVSS:4.0 | CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N |
| VulnCheck | 6.5medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N |
| GitHub | 6.5medium CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N |
| PyPA Advisory Database | Not scored CVSS:4.0 | CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X |
Classification
What each source says
CVE List
GitPython versions before 3.1.59 contain an incomplete denylist in the unsafe_git_revision_options guard that omits --contents and -S options, allowing attackers to read arbitrary files by passing these options to Repo.blame(). Attackers can supply revision values like --contents=/etc/passwd to leak file contents through the blame result returned to the caller.
GitHub Advisory Database
Summary
Repo.blame() / Repo.blame_incremental() guard forwarded revision options against unsafe_git_revision_options, but that denylist only contains the file-WRITE options --output/-o. git blame also honors --contents <file> and -S <file>, which cause the file's lines to be echoed into the blame result — an arbitrary file READ. Neither option is in the denylist, so a caller-influenced revision value of --contents=<path> passes the guard and leaks file contents. This is a distinct sink-option and impact class (READ) from GHSA-956x-8gvw-wg5v (which addressed the blame --output WRITE), directly analogous to GHSA-539m-9xh6-q6rr (archive READ gap accepted separately from the archive write/exec advisory).
Root Cause
unsafe_git_revision_options = ["--output","-o"] (git/repo/base.py:188). The rev string is passed to _option_candidates([rev], kwargs) and placed BEFORE the -- separator (base.py:841). The canonical name of --contents=... is contents, which is not on the denylist, so no UnsafeOptionError is raised. The trailing -- protects only the pathspec, not the option before the revision.
Impact
Arbitrary local file read at the privileges of the host process; the file's line contents appear in the blame result returned to the caller. Pure VALUE control (the caller forwards a user-influenced revision string). Default allow_unsafe_options=False.
Proof of Concept
result = repo.blame("--contents=/etc/passwd", "a.txt")
# result rows carry the victim file's line text
Attack Chain
- Entry: app calls
repo.blame(rev, file)with attackerrev="--contents=/etc/passwd"(or kwargcontents="/etc/passwd", or-S). - Check:
Git.check_unsafe_options(_option_candidates([rev,...], kwargs), unsafe_git_revision_options)@ base.py:841. Guard: denylist =["--output","-o"]only. Bypass proof: canonical namecontents∉ denylist → no error. - Sink:
self.git.blame(rev, "--", file, p=True, ...). argv (observed):['git','blame','-p','--contents=<secret>','HEAD','--','a.txt']. - Impact: blame result rows carry the victim file's line text.
Bypass Evidence
Independently reproduced (independent test harness, default allow_unsafe_options=False): blame('--contents=<secret>','a.txt') → guard PASSED; result rows = ['GATE_SECRET_LINE_A','GATE_SECRET_LINE_B']. Control: blame('--output=…') still BLOCKED (guard active on this path). -S kwarg argv also reaches git unguarded.
Affected Versions
GitPython <= 3.1.58 (denylist present verbatim on the latest release tag).
Suggested Fix
Prefer an allowlist of blame options; at minimum add --contents/-S (and any other path-taking blame options) to unsafe_git_revision_options, and make the membership rule "the option takes a filesystem path" rather than "the option writes output".
Reported by zx (Jace) — GitHub: @manus-use
NVD (es)
Versiones de GitPython anteriores a la 3.1.59 contienen una lista de denegación incompleta en el protector unsafe_git_revision_options que omite las opciones --contents y -S, permitiendo a los atacantes leer archivos arbitrarios al pasar estas opciones a Repo.blame(). Los atacantes pueden proporcionar valores de revisión como --contents=/etc/p4ssd para filtrar el contenido de archivos a través del resultado de blame devuelto a quien llama.
References
| https://github.com/gitpython-developers/GitPython/security/advisories/GHSA-5xxx-qhh7-9287 | evidence, exploit, vendor-advisory, web | |
| https://www.vulncheck.com/advisories/gitpython-before-arbitrary-file-read-via-repo-blame | advisory, third-party-advisory, web | |
| https://nvd.nist.gov/vuln/detail/CVE-2026-78678 | advisory | |
| https://github.com/gitpython-developers/GitPython | package | |
| https://github.com/pypa/advisory-database/tree/main/vulns/gitpython/PYSEC-2026-3788.yaml | web | |
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2026-78678 changed 2026-10-08 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-5xxx-qhh7-9287 changed 2026-09-08 | CC-BY-4.0 |
| NVD | CVE-2026-78678 changed 2026-10-12 | Public domain |
| PyPA Advisory Database | PYSEC-2026-3788 changed 2026-09-03 | CC-BY-4.0 |