VAITP Dataset

← Back to the dataset

CVE-2026-73624

Arbitrary file overwrite via unchecked –output in GitPython < 3.1.54 Diffable.diff.

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

GitPython versions before 3.1.54 contain an arbitrary file overwrite vulnerability in the Diffable.diff method that fails to validate git options passed through kwargs. Attackers can supply the –output argument via the other parameter or output kwarg to write patch content to attacker-chosen file paths at process privilege level.

CVSS base score
7.2
Published
2026-08-13
OWASP
A08 Software and Data Integrity Failures
Orthogonal defect classification
Interface
Code defect classification
Incorrect Interface
Category
Input Validation and Sanitization
Subcategory
Path Traversal
Accessibility scope
Remote
Impact
Arbitrary Code Execution
Affected component
GitPython
Fixed by upgrading
Yes

Solution

Upgrade GitPython to version 3.1.54 or newer.

Vulnerable code sample

import os
from git import Repo

class PatchGenerator:
    def __init__(self, repo_path):
        self.repo = Repo(repo_path)

    def generate_patch(self, rev_a, rev_b, output_path):
        """
        Generate a diff between two revisions and write it to output_path.
        """
        # VULNERABLE: passes user-controlled '--output' via kwargs to git diff
        diff = self.repo.git.diff(rev_a, rev_b, **{'--output': output_path})
        return diff

Patched code sample

import os
from git import Repo

class PatchGenerator:
    def __init__(self, repo_path):
        self.repo = Repo(repo_path)

    def generate_patch(self, rev_a, rev_b, output_path):
        """
        Generate a diff between two revisions and write it to output_path.
        """
        # FIX: remove unsafe '--output' option; write diff safely in Python
        diff = self.repo.git.diff(rev_a, rev_b)
        with open(output_path, 'w', encoding='utf-8') as f:
            f.write(diff)
        return diff

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.

  • fix: guard diff output options (gitpython-developers/GitPython)
    git/diff.py, git/diff.py · Diffable.diff, git/index/base.py, git/index/base.py · IndexFile.diff

Cite this entry

@misc{vaitp:cve202673624,
  title        = {{Arbitrary file overwrite via unchecked --output in GitPython < 3.1.54 Diffable.diff.}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2026},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2026-73624},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-73624/}}
}

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.