{"id":"CVE-2026-78678","aliases":["CVE-2026-78678","GHSA-5xxx-qhh7-9287","PYSEC-2026-3788"],"related":[],"kind":"vulnerability","state":"published","title":"GitPython before 3.1.59 Arbitrary File Read via Repo.blame()","summary":"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.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"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.","source":"cvelist"},{"lang":"en","text":"## Summary\n`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).\n\n## Root Cause\n`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.\n\n## Impact\nArbitrary 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`.\n\n## Proof of Concept\n```python\nresult = repo.blame(\"--contents=/etc/passwd\", \"a.txt\")\n# result rows carry the victim file's line text\n```\n\n## Attack Chain\n1. Entry: app calls `repo.blame(rev, file)` with attacker `rev=\"--contents=/etc/passwd\"` (or kwarg `contents=\"/etc/passwd\"`, or `-S`).\n2. Check: `Git.check_unsafe_options(_option_candidates([rev,...], kwargs), unsafe_git_revision_options)` @ base.py:841. Guard: denylist = `[\"--output\",\"-o\"]` only. Bypass proof: canonical name `contents` ∉ denylist → no error.\n3. Sink: `self.git.blame(rev, \"--\", file, p=True, ...)`. argv (observed): `['git','blame','-p','--contents=<secret>','HEAD','--','a.txt']`.\n4. Impact: blame result rows carry the victim file's line text.\n\n## Bypass Evidence\nIndependently 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.\n\n## Affected Versions\n`GitPython <= 3.1.58` (denylist present verbatim on the latest release tag).\n\n## Suggested Fix\nPrefer 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\".\n\n---\nReported by **zx (Jace)** — GitHub: @manus-use","format":"markdown","source":"ghsa"},{"lang":"es","text":"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.","source":"nvd"}],"published":"2026-08-25T01:30:35.582Z","modified":"2026-10-12T15:10:00.207Z","severity":{"scorer":"VulnCheck","scheme":"CVSS:4.0","vector":"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","score":7.1,"rating":"HIGH"},"severities":[{"scorer":"VulnCheck","scheme":"CVSS:4.0","vector":"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","score":7.1,"rating":"HIGH"},{"scorer":"VulnCheck","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N","score":6.5,"rating":"MEDIUM"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N","score":6.5,"rating":"MEDIUM"},{"scorer":"PyPA Advisory Database","scheme":"CVSS:4.0","vector":"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"}],"cwes":["CWE-88","CWE-200"],"affected":[{"ranges":[{"type":"semver","introduced":"0","fixed":"3.1.59","status":"affected"},{"type":"semver","version":"3.1.59","status":"unaffected"}],"vendor":"gitpython-developers","product":"GitPython","source":"cvelist"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"3.1.59"}],"ecosystem":"PyPI","package":"gitpython","purl":"pkg:pypi/gitpython","source":"ghsa"},{"ranges":[{"status":"affected","fixed":"3.1.59"}],"vendor":"gitpython_project","product":"gitpython","cpe":"cpe:2.3:a:gitpython_project:gitpython:*:*:*:*:*:python:*:*","source":"nvd"},{"ranges":[{"type":"ecosystem","introduced":"0","status":"affected","fixed":"3.1.59"}],"ecosystem":"PyPI","package":"gitpython","purl":"pkg:pypi/gitpython","source":"pysec"}],"references":[{"url":"https://github.com/gitpython-developers/GitPython/security/advisories/GHSA-5xxx-qhh7-9287","tags":["evidence","exploit","vendor-advisory","web"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://www.vulncheck.com/advisories/gitpython-before-arbitrary-file-read-via-repo-blame","tags":["advisory","third-party-advisory","web"],"sources":["cvelist","ghsa","nvd","pysec"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-78678","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/gitpython-developers/GitPython","tags":["package"],"sources":["ghsa"]},{"url":"https://github.com/pypa/advisory-database/tree/main/vulns/gitpython/PYSEC-2026-3788.yaml","tags":["web"],"sources":["ghsa"]}],"credits":["manus-use"],"assigner":"VulnCheck","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"partial","date":"2026-08-25T15:17:54.526Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-78678","url":"https://www.cve.org/CVERecord?id=CVE-2026-78678","licence":"CVE Terms of Use","modified":"2026-10-08T15:25:09.232Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-5xxx-qhh7-9287","url":"https://github.com/advisories/GHSA-5xxx-qhh7-9287","licence":"CC-BY-4.0","modified":"2026-09-08T19:00:06.904Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-78678","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-78678","licence":"Public domain","modified":"2026-10-12T15:10:00.207Z"},{"source":"pysec","name":"PyPA Advisory Database","id":"PYSEC-2026-3788","url":"https://osv.dev/vulnerability/PYSEC-2026-3788","licence":"CC-BY-4.0","modified":"2026-09-03T11:00:03.883Z"}],"updatedAt":"2026-11-25T22:59:35.100Z","epss":{"score":0.00302,"percentile":0.24678,"date":"2026-12-01T12:00:22.000Z"}}