CVE-2026-78679
Arbitrary file read via TagReference.create() bypassing unsafe guard.
- CVSS 7.1
- CWE-73
- Information Leakage
- Remote
GitPython before 3.1.59 contains an arbitrary file read vulnerability in TagReference.create() where a positional reference parameter bypasses the unsafe option guard. Attackers can supply a reference value like –file= to read arbitrary files, with contents returned in the annotated tag message.
- CWE
- CWE-73
- CVSS base score
- 7.1
- Published
- 2026-08-25
- OWASP
- A04 Insecure Design
- Orthogonal defect classification
- Checking
- Code defect classification
- Missing Check
- Category
- Information Leakage
- Subcategory
- Information Disclosure
- Accessibility scope
- Remote
- Impact
- Information Disclosure
- Affected component
- GitPython
- Fixed by upgrading
- Yes
Solution
Upgrade GitPython to version 3.1.59 or newer.
Vulnerable code sample
import git
def create_tag(repo_path: str, tag_name: str, ref: str, message: str) -> None:
"""
Creates an annotated tag using a user‑supplied ref.
"""
repo = git.Repo(repo_path)
# VULNERABLE: positional `ref` bypasses the unsafe guard, allowing '--file=' injection
repo.tags.create(tag_name, ref, message=message, force=True)Patched code sample
import git
def create_tag(repo_path: str, tag_name: str, ref: str, message: str) -> None:
"""
Creates an annotated tag using a user‑supplied ref, with validation.
"""
repo = git.Repo(repo_path)
# FIX: reject refs that start with '--file=' to prevent arbitrary file read
if ref.lstrip().startswith('--file='):
raise ValueError("Invalid tag reference")
repo.tags.create(tag_name, ref, message=message, force=True)Published fix
Public sources link this CVE to the changes below. The code samples above were generated to illustrate the defect; these links lead to the code the project actually changed.
- Block file-reading Git options (gitpython-developers/GitPython)
git/cmd.py,git/cmd.py · Git.check_unsafe_options,git/cmd.py · Git.ls_remote,git/diff.py · Diffable.diff,git/index/base.py · IndexFile.diff,git/refs/tag.py · TagReference.create,git/repo/base.py,git/repo/base.py · Repo.blame,git/repo/base.py · Repo.blame_incremental
Cite this entry
@misc{vaitp:cve202678679,
title = {{Arbitrary file read via TagReference.create() bypassing unsafe guard.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2026-78679},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-78679/}}
}
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 ::
