CVE-2026-67322: GitPython · Environment-variable exfiltration via os.path.expandvars() on Repo.clone_from() URL
Affects GitPythonSource GCVE Database
Mentioned vulnerabilities
CVSS 7.5 High : upgrade to 3.1.52 soon.
Data as of 26 Oct 2026, 16:10 UTC
- Patch
- Available – fixed in 3.1.52
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:NWhat to do
Upgrade gitpython and GitPython to 3.1.52.
Affected software
| Product | Affected | Fixed in |
|---|---|---|
| PyPIgitpython | Affected
| Fixed in
|
| PyPIGitPython | Affected
| Fixed in
|
Check your own hosts for these packages with threat-finder (opens in a new tab), our free open-source scanner.
AI-suggested
If you cannot patch yet, avoid using Repo.clone_from() with untrusted URLs or URLs that could contain environment variable expansions. Restrict environment variables accessible to the GitPython process to minimize secret exposure. Do not rely on the unsafe-protocol filter alone as it is applied before variable expansion and can be bypassed.
Description
GitPython versions up to 3.1.50 (and before 3.1.52) contain a vulnerability where the Repo.clone_from() method passes the remote URL through os.path.expandvars() on non-Cygwin platforms. This causes environment variables embedded as $NAME or ${NAME} in the URL to be expanded using the server process's environment, potentially leaking secrets such as AWS keys or tokens to attacker-controlled hosts. The vulnerability arises because polish_url(), intended for local path normalization, is incorrectly applied to remote URLs without scheme checks or an opt-out for variable expansion. Additionally, the unsafe-protocol check is performed on the raw URL before expansion, allowing bypass if an attacker controls environment variables.
References
- github.com/gitpython-developers/GitPython/security/advisories/GHSA-rwj8-pgh3-r573 (opens in a new tab)
- github.com/gitpython-developers/GitPython/pull/2172 (opens in a new tab)
- github.com/gitpython-developers/GitPython/commit/8ac5a30519b6f4af85398b9b9d7064ff4d452da2 (opens in a new tab)
- github.com/gitpython-developers/GitPython (opens in a new tab)
- github.com/gitpython-developers/GitPython/releases/tag/3.1.52 (opens in a new tab)
- nvd.nist.gov/vuln/detail/CVE-2026-67322 (opens in a new tab)
- github.com/advisories/GHSA-rwj8-pgh3-r573 (opens in a new tab)
- github.com/pypa/advisory-database/tree/main/vulns/gitpython/PYSEC-2026-3842.yaml (opens in a new tab)
- pypi.org/project/gitpython (opens in a new tab)
- vulncheck.com/advisories/gitpython-before-environment-variable-exfiltration-via-clone-from (opens in a new tab)