Skip to main content
VulnerabilityPublished Updated

CVE-2026-67322: GitPython · Environment-variable exfiltration via os.path.expandvars() on Repo.clone_from() URL

Affects GitPythonSource GCVE Database

0

Mentioned vulnerabilities

CVSS 7.5 High : upgrade to 3.1.52 soon.

Data as of 26 Oct 2026, 16:10 UTC

CVSS 3.1 base score
7.5High
How severe the flaw is on the 0–10 CVSS scale.
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:N

What to do

Upgrade gitpython and GitPython to 3.1.52.

Affected software

ProductAffectedFixed in
PyPIgitpythonAffected
  • <3.1.52
Fixed in
  • 3.1.52
PyPIGitPythonAffected
  • <3.1.52
Fixed in
  • 3.1.52

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

Community reviews

Loading reviews…