VAITP Dataset

← Back to the dataset

CVE-2026-76219

Arbitrary file overwrite via malicious –index-output injection in GitPython.

  • CVSS 7.2
  • CWE-88
  • Input Validation and Sanitization
  • Remote

GitPython versions before 3.1.58 contain an arbitrary file overwrite vulnerability in IndexFile.from_tree, IndexFile.reset, and IndexFile.merge_tree methods that append caller-influenced treeish strings to git read-tree without option validation or argument separation. Attackers can inject the –index-output option to overwrite arbitrary files with a valid git-index blob, destroying existing file content at attacker-controlled writable paths.

CVSS base score
7.2
Published
2026-08-19
OWASP
A03 Injection
Orthogonal defect classification
Checking
Code defect classification
Missing Check
Category
Input Validation and Sanitization
Subcategory
Command Injection
Accessibility scope
Remote
Impact
Denial of Service (DoS)
Affected component
GitPython
Fixed by upgrading
Yes

Solution

Upgrade GitPython to version 3.1.58 or newer.

Vulnerable code sample

from git import Repo

def apply_tree(repo_path: str, treeish: str) -> None:
    """
    Checkout a treeish into the repository index.
    The `treeish` argument is taken from an untrusted source.
    """
    repo = Repo(repo_path)
    # VULNERABLE: concatenating untrusted `treeish` into the git command
    repo.index.from_tree(treeish)

Patched code sample

from git import Repo

def apply_tree(repo_path: str, treeish: str) -> None:
    """
    Checkout a treeish into the repository index.
    The `treeish` argument is taken from an untrusted source.
    """
    repo = Repo(repo_path)
    # FIX: invoke git with explicit argument list to avoid injection
    repo.git.read_tree('--', treeish)

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.

  • Guard read-tree index output paths (gitpython-developers/GitPython)
    git/index/base.py, git/index/base.py · IndexFile.from_tree, git/index/base.py · IndexFile.merge_tree, git/index/base.py · IndexFile.reset

Cite this entry

@misc{vaitp:cve202676219,
  title        = {{Arbitrary file overwrite via malicious --index-output injection in GitPython.}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2026},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2026-76219},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-76219/}}
}

Download this entry as JSON Download the whole dataset

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 ::

Before you use the VAITP AI models

Please read and accept the following disclaimer:

By choosing "I understand and accept", you acknowledge that you understand and agree to these terms.