VAITP Dataset

← Back to the dataset

CVE-2026-67322

Environment variable leakage via GitPython’s Repo.clone_from URL expansion.

  • CVSS 8.7
  • CWE-200
  • Information Leakage
  • Remote

GitPython before 3.1.52 is vulnerable to environment-variable exfiltration in Repo.clone_from(). The caller-supplied remote URL is passed through Git.polish_url(), which on non-Cygwin platforms calls os.path.expandvars() on the URL before invoking git clone. An attacker who controls the clone URL can embed $NAME or ${NAME} tokens that are expanded to the values of the hosting process's environment variables (e.g., AWS_SECRET_ACCESS_KEY or GITHUB_TOKEN). The resulting URL, now containing the secret, is transmitted over the network to an attacker-controlled host during the clone attempt, disclosing the secret.

CVSS base score
8.7
Published
2026-08-01
OWASP
A10 Server-Side Request Forgery (SSRF)
Orthogonal defect classification
Checking
Code defect classification
Missing Check
Category
Information Leakage
Subcategory
Information Disclosure
Accessibility scope
Remote
Impact
Information Disclosure
Affected component
GitPython
Fixed by upgrading
Yes

Solution

Upgrade GitPython to version 3.1.52 or later.

Vulnerable code sample

import os
from git import Repo

def clone_repository(remote_url: str, target_path: str) -> Repo:
    # VULNERABLE: expands environment variables in the URL via GitPython's internal polish_url()
    repo = Repo.clone_from(remote_url, target_path)
    return repo

Patched code sample

import os
import urllib.parse
from git import Repo

def clone_repository(remote_url: str, target_path: str) -> Repo:
    # FIX: encode '$' to prevent os.path.expandvars() from expanding environment variables
    safe_url = urllib.parse.quote(remote_url, safe='/:@')
    repo = Repo.clone_from(safe_url, target_path)
    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.

  • fix: prevent environment expansion in clone URLs (gitpython-developers/GitPython)
    git/cmd.py · Git.polish_url, git/cmd.py · Git.polish_url#2, git/cmd.py · Git.polish_url#3, git/repo/base.py · Repo._clone, git/util.py · cygpath, git/util.py · _cygexpath

Cite this entry

@misc{vaitp:cve202667322,
  title        = {{Environment variable leakage via GitPython’s Repo.clone_from URL expansion.}},
  author       = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
  year         = {2026},
  note         = {VAITP Python Vulnerability Dataset, entry CVE-2026-67322},
  howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-67322/}}
}

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.