VAITP Dataset

← Back to the dataset

CVE-2026-67325

GitPython <3.1.51 allows command injection via abbreviated git long‑options.

  • CVSS 8.7
  • CWE-78
  • Input Validation and Sanitization
  • Remote

GitPython before 3.1.51 contains an incomplete command injection blocklist that fails to account for git's long-option prefix abbreviation feature. Attackers can bypass the unsafe options guard by using abbreviated option names like upload_p instead of upload_pack, which git resolves to dangerous options and executes arbitrary commands.

CVSS base score
8.7
Published
2026-08-01
OWASP
A03 Injection
Orthogonal defect classification
Interface
Code defect classification
Missing Check
Category
Input Validation and Sanitization
Subcategory
Command Injection
Accessibility scope
Remote
Impact
Arbitrary Code Execution
Affected component
GitPython
Fixed by upgrading
Yes

Solution

Upgrade GitPython to version 3.1.51 or later.

Vulnerable code sample

import os
from git import Repo

def clone_repository(repo_url: str, dest_path: str, extra_git_options: list[str]) -> Repo:
    """
    Clone a repository, allowing the caller to pass additional git command line options.
    """
    # VULNERABLE: passes unchecked user‑controlled options to git, allowing abbreviation bypass
    repo = Repo.clone_from(repo_url, dest_path, multi_options=extra_git_options)
    return repo

def example_usage():
    # user input could be something like ['--upload_p', 'ssh://evil.com/evil.git']
    user_options = os.getenv("GIT_EXTRA_OPTS", "").split()
    clone_repository("https://example.com/legit.git", "/tmp/legit", user_options)

Patched code sample

import os
from git import Repo

def clone_repository(repo_url: str, dest_path: str, extra_git_options: list[str]) -> Repo:
    """
    Clone a repository, allowing only safe git command line options.
    """
    # FIX: filter out any option that is not explicitly whitelisted
    allowed_options = {"--depth", "--branch", "--single-branch"}
    safe_options = [opt for opt in extra_git_options if opt.split('=')[0] in allowed_options]
    repo = Repo.clone_from(repo_url, dest_path, multi_options=safe_options)
    return repo

def example_usage():
    # user input could be something like ['--depth=1']
    user_options = os.getenv("GIT_EXTRA_OPTS", "").split()
    clone_repository("https://example.com/legit.git", "/tmp/legit", user_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.

Cite this entry

@misc{vaitp:cve202667325,
  title        = {{GitPython <3.1.51 allows command injection via abbreviated git long‑options.}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2026},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2026-67325},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-67325/}}
}

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.