CVE-2026-78678
Incomplete denylist lets –contents/-S in Repo.blame() read arbitrary files.
- CVSS 7.1
- CWE-88
- Information Leakage
- Local
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.
- CWE
- CWE-88
- CVSS base score
- 7.1
- Published
- 2026-08-25
- OWASP
- A03 Injection
- Orthogonal defect classification
- Checking
- Code defect classification
- Missing Check
- Category
- Information Leakage
- Subcategory
- Information Disclosure
- Accessibility scope
- Local
- Impact
- Information Disclosure
- Affected component
- GitPython
- Fixed by upgrading
- Yes
Solution
Upgrade GitPython to version 3.1.59 or newer.
Vulnerable code sample
import sys
from git import Repo
def get_blame(repo_path: str, file_path: str, revision: str):
"""
Return blame information for a file at a given revision.
"""
repo = Repo(repo_path)
# VULNERABLE: passes unchecked revision to Repo.blame, allowing '--contents' injection
blame = repo.blame(revision, file_path)
return blame
# Example usage (not executed in the sample):
# blame_info = get_blame("/path/to/repo", "src/main.py", sys.argv[1])Patched code sample
import sys
from git import Repo
def get_blame(repo_path: str, file_path: str, revision: str):
"""
Return blame information for a file at a given revision.
"""
# FIX: reject unsafe revision options that can read arbitrary files
unsafe_opts = ('--contents', '-S')
if any(opt in revision.split() for opt in unsafe_opts):
raise ValueError("Unsafe revision option detected")
repo = Repo(repo_path)
blame = repo.blame(revision, file_path)
return blame
# Example usage (not executed in the sample):
# blame_info = get_blame("/path/to/repo", "src/main.py", sys.argv[1])Cite this entry
@misc{vaitp:cve202678678,
title = {{Incomplete denylist lets --contents/-S in Repo.blame() read arbitrary files.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2026-78678},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-78678/}}
}
Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.
The supreme art of war is to subdue the enemy without fighting.
Sun Tzu – “The Art of War”
:: Shaping the future through research and ingenuity ::
