VAITP Dataset

← Back to the dataset

CVE-2026-76220

Command injection via unsafe kwargs bypass in GitPython’s check_unsafe_options.

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

GitPython before 3.1.58 contains a command execution vulnerability in the check_unsafe_options guard that can be bypassed by combining a single-character kwarg with split_single_char_options=False. Attackers can supply a crafted kwargs dictionary to guarded methods like clone_from to emit a joined token parsed as –upload-pack, enabling arbitrary OS command execution at default allow_unsafe_options=False.

CVSS base score
8.7
Published
2026-08-19
OWASP
A03 Injection
Orthogonal defect classification
Checking
Code defect classification
Incorrect 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.58 or newer.

Vulnerable code sample

import git

def clone_repo(url, path):
    # VULNERABLE: single-character kwarg combined with split_single_char_options=False allows command injection
    repo = git.Repo.clone_from(
        url,
        path,
        split_single_char_options=False,
        u='ssh://example.com/evil.git'  # crafted to become '--upload-pack=ssh://example.com/evil.git'
    )
    return repo

Patched code sample

import git

def clone_repo(url, path):
    # FIX: use full option name and default splitting to prevent injection
    repo = git.Repo.clone_from(
        url,
        path,
        upload_pack='ssh://example.com/evil.git'  # safe explicit option
    )
    return repo

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:cve202676220,
  title        = {{Command injection via unsafe kwargs bypass in GitPython’s check_unsafe_options.}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2026},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2026-76220},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-76220/}}
}

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.