VAITP Dataset

← Back to the dataset

CVE-2026-73622

GitPython URL handling expands env vars, leaking secrets via crafted URLs.

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

GitPython before 3.1.55 fails to disable environment variable expansion in Remote.create() and Submodule.add() URL handling, allowing attackers to exfiltrate secrets by supplying URLs containing variable references. Attackers can craft URLs with environment variable tokens that are expanded into .git/config and .gitmodules, then transmitted to attacker-controlled hosts during fetch or pull operations.

CVSS base score
8.7
Published
2026-08-13
OWASP
A05 Security Misconfiguration
Orthogonal defect classification
Checking
Code defect classification
Missing Check
Category
Input Validation and Sanitization
Subcategory
Insecure Parsing or Deserialization
Accessibility scope
Remote
Impact
Information Disclosure
Affected component
GitPython
Fixed by upgrading
Yes

Solution

Upgrade GitPython to version 3.1.55 or later.

Vulnerable code sample

import os
from git import Repo

def add_remote(repo_path: str, remote_name: str, remote_url: str) -> None:
    """
    Add a new remote to the repository. The URL is passed directly,
    allowing GitPython to expand environment variables like $HOME.
    """
    repo = Repo(repo_path)
    # VULNERABLE: environment variable expansion in Remote.create()
    repo.create_remote(remote_name, remote_url)

Patched code sample

import os
import urllib.parse
from git import Repo

def add_remote(repo_path: str, remote_name: str, remote_url: str) -> None:
    """
    Add a new remote to the repository. The URL is sanitized to prevent
    environment variable expansion during Remote.create().
    """
    repo = Repo(repo_path)
    # FIX: encode URL to avoid env‑var expansion
    safe_url = urllib.parse.quote(remote_url, safe=':/@')
    repo.create_remote(remote_name, safe_url)

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:cve202673622,
  title        = {{GitPython URL handling expands env vars, leaking secrets via crafted URLs.}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2026},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2026-73622},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-73622/}}
}

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.