GHSA-rwj8-pgh3-r573: GitPython: Environment-variable exfiltration via os.path.expandvars() on Repo.clone_from() URL
(updated )
Repo.clone_from() passes the caller-supplied remote URL through Git.polish_url(), which on every non-Cygwin platform calls os.path.expandvars() on the URL before handing it to git clone. An attacker who controls the URL argument — the documented use case for clone_from() in “import repository from URL” features of CI servers, git-hosting mirrors, and dependency scanners — can embed $NAME / ${NAME} tokens that are expanded server-side to the values of the hosting process’s environment variables. The resulting URL, now containing the secret, is transmitted over the network to the attacker-named host. This crosses the trust boundary between an untrusted remote URL and the server’s process environment, disclosing secrets such as AWS_SECRET_ACCESS_KEY or GITHUB_TOKEN with no precondition beyond the ability to submit a clone URL.
References
- github.com/advisories/GHSA-rwj8-pgh3-r573
- github.com/gitpython-developers/GitPython
- github.com/gitpython-developers/GitPython/commit/8ac5a30519b6f4af85398b9b9d7064ff4d452da2
- github.com/gitpython-developers/GitPython/pull/2172
- github.com/gitpython-developers/GitPython/releases/tag/3.1.52
- github.com/gitpython-developers/GitPython/security/advisories/GHSA-rwj8-pgh3-r573
- github.com/pypa/advisory-database/tree/main/vulns/gitpython/PYSEC-2026-3842.yaml
- nvd.nist.gov/vuln/detail/CVE-2026-67322
- pypi.org/project/gitpython
- www.vulncheck.com/advisories/gitpython-before-environment-variable-exfiltration-via-clone-from
Code Behaviors & Features
Detect and mitigate GHSA-rwj8-pgh3-r573 with GitLab Dependency Scanning
Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Dependency Scanning using SBOM also detects vulnerabilities from proprietary advisories that this site does not include. Learn more about Dependency Scanning using SBOM →