CVE-2026-73620
GitPython 3.1.57 lacks option guarding, enabling unsafe –prefix/-F injection.
- CVSS 7.2
- CWE-22
- Input Validation and Sanitization
- Local
GitPython before 3.1.57 fails to guard git option forwarding in IndexFile.checkout() and TagReference.create(), allowing attackers to pass unsafe options via kwargs. Attackers can use –prefix to overwrite arbitrary files with repository content or -F to read arbitrary files returned in-band.
- CWE
- CWE-22
- CVSS base score
- 7.2
- Published
- 2026-08-13
- OWASP
- A03 Injection
- Orthogonal defect classification
- Checking
- Code defect classification
- Missing Check
- Category
- Input Validation and Sanitization
- Subcategory
- Command Injection
- Accessibility scope
- Local
- Impact
- Information Disclosure
- Affected component
- GitPython
- Fixed by upgrading
- Yes
Solution
Upgrade GitPython to 3.1.57 or later to fix the unsafe option forwarding issue.
Vulnerable code sample
import git
from typing import Dict, Any
def checkout_branch(repo_path: str, branch: str, git_options: Dict[str, Any]) -> None:
"""
Checkout a branch using GitPython, forwarding user‑supplied git options directly.
"""
repo = git.Repo(repo_path)
# VULNERABLE: forwards unsafe git options (e.g., '--prefix' or '-F') to the subprocess
repo.index.checkout(branch, **git_options)Patched code sample
import git
from typing import Dict, Any
def checkout_branch(repo_path: str, branch: str, git_options: Dict[str, Any]) -> None:
"""
Checkout a branch using GitPython, allowing only a safe whitelist of git options.
"""
repo = git.Repo(repo_path)
# FIX: filter out disallowed git options before forwarding to the subprocess
safe_keys = {"force", "quiet"} # example whitelist of allowed option names
filtered_options = {k: v for k, v in git_options.items() if k in safe_keys}
repo.index.checkout(branch, **filtered_options)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 unsafe checkout-index and tag file options (gitpython-developers/GitPython)
git/index/base.py,git/index/base.py · IndexFile.checkout,git/refs/tag.py,git/refs/tag.py · TagReference.create
Cite this entry
@misc{vaitp:cve202673620,
title = {{GitPython 3.1.57 lacks option guarding, enabling unsafe --prefix/-F injection.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2026-73620},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-73620/}}
}
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 ::
