---
schema_version: '1.0'
id: security-20260909-be8c4d
title: 'CVE-2026-78678: GitPython: Incomplete unsafe_git_revision_options denylist
  omits --contents/-S, enabling arbitrary file read via Repo.blame()'
url: https://osv.dev/vulnerability/GHSA-5xxx-qhh7-9287
url_hash: be8c4d09a32fc8bbe9b99c8a96cff1d63637de19f1e1571d4893daefc3693bc5
canonical_url: https://osv.dev/vulnerability/GHSA-5xxx-qhh7-9287
source: osv:ghsa
category: security/library
category_raw: cve/library
region: null
tags:
- cve
- CVE-2026-78678
- GHSA-5xxx-qhh7-9287
- severity:CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N
- gitpython
- PyPI
lang: en
published_at: '2026-09-08T18:41:31Z'
fetched_at: '2026-09-09T15:41:01.428934Z'
updated_at: '2026-09-09T15:52:38Z'
status: published
content_hash: 06f2e6456efa7ea3844eee5d001acd2c83912be9c00ca2f47d815a168795c864
content_changed_at: null
license_note: full
summary: 'GitPython: Incomplete unsafe_git_revision_options denylist omits --contents/-S,
  enabling arbitrary file read via Repo.blame()'
summary_source: rss
summary_en: 'GitPython: Incomplete unsafe_git_revision_options denylist omits --contents/-S,
  enabling arbitrary file read via Repo.blame()'
summary_omitted_reason: null
redistribution: true
keywords_en:
- arbitrary
- contents
- CVE
- CVE-2026-78678
- denylist
- enabling
- file
- GHSA-5xxx-qhh7-9287
- Git
- gitpython
- GitPython関連
- Incomplete
- library vulnerability
- omits
- PyPI
- read
- Repo.blame
- severity:CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N
- software security
- unsafe_git_revision_options
- via
entities_en:
- name: CVE
  type: data
- name: Git
  type: UNKNOWN
- name: GitPython関連
  type: content
topics_en:
- library vulnerability
- software security
numeric_facts: []
entities:
- name: CVE
  type: data
- name: GitPython関連
  type: content
- name: Git
  type: UNKNOWN
key_facts: []
related: []
related_auto:
- name: 確定記憶
  type: concept
  weight: 3.0
- name: 候補
  type: concept
  weight: 2.0
- name: 集団的免疫力
  type: concept
  weight: 1.0
computed_at: '2026-09-09T15:52:32Z'
---

# CVE-2026-78678: GitPython: Incomplete unsafe_git_revision_options denylist omits --contents/-S, enabling arbitrary file read via Repo.blame()

## TL;DR
GitPython: Incomplete unsafe_git_revision_options denylist omits --contents/-S, enabling arbitrary file read via Repo.blame()

## Key Points
- cve / CVE-2026-78678 / GHSA-5xxx-qhh7-9287 / severity:CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N / gitpython / PyPI

## Details
**Severity:** CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N
**Advisory:** GHSA-5xxx-qhh7-9287 (CVE-2026-78678)

**Details:**
## 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
```python
result = repo.blame("--contents=/etc/passwd", "a.txt")
# result rows carry the victim file's line text
```

## Attack Chain
1. Entry: app calls `repo.blame(rev, file)` with attacker `rev="--contents=/etc/passwd"` (or kwarg `contents="/etc/passwd"`, or `-S`).
2. 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.
3. Sink: `self.git.blame(rev, "--", file, p=True, ...)`. argv (observed): `['git','blame','-p','--contents=<secret>','HEAD','--','a.txt']`.
4. 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

**References:**
- https://github.com/gitpython-developers/GitPython/security/advisories/GHSA-5xxx-qhh7-9287
- https://nvd.nist.gov/vuln/detail/CVE-2026-78678
- https://github.com/gitpython-developers/GitPython
- https://github.com/pypa/advisory-database/tree/main/vulns/gitpython/PYSEC-2026-3788.yaml
- https://www.vulncheck.com/advisories/gitpython-before-arbitrary-file-read-via-repo-blame

_Data: OSV.dev (upstream: ghsa) — https://osv.dev/vulnerability/GHSA-5xxx-qhh7-9287_

## Source
元記事: [CVE-2026-78678: GitPython: Incomplete unsafe_git_revision_options denylist omits --contents/-S, enabling arbitrary file read via Repo.blame()](https://osv.dev/vulnerability/GHSA-5xxx-qhh7-9287) — published 2026-09-08T18:41:31Z
