ZeroHour

CVE-2026-67322

PoC large

Environment-Variable Exfiltration via Repo.clone_from() in GitPython

CVSS 4.0
8.7 high
EPSS
<1%p20
Published
()
Modified
AI analysis

GitPython before 3.1.52 leaks process environment variables through Repo.clone_from(), because the caller-supplied remote URL is passed through Git.polish_url(), which on non-Cygwin platforms runs os.path.expandvars() on the URL before invoking git clone. An attacker who controls the clone URL can embed $NAME or ${NAME} tokens, which are expanded to the hosting process's environment variable values (such as AWS_SECRET_ACCESS_KEY or GITHUB_TOKEN) at clone time. The expanded URL, now containing the secret, is transmitted over the network to the attacker-controlled host during the clone attempt, giving the attacker credential disclosure with no integrity or availability impact. Any Python application, CI pipeline, or automation service that passes attacker-influenced URLs to GitPython's clone functions is affected. There are no confirmed reports of exploitation in the wild (EPSS 0.3%, not in CISA KEV), but a public advisory with proof-of-concept details is available and a fixed release, 3.1.52, exists.

What to do: Upgrade to GitPython 3.1.52 or later. As interim mitigations, avoid passing untrusted URLs to Repo.clone_from()/Git.clone, strip or escape '$' characters in remote URLs before use, and restrict which environment variables are visible to processes that clone attacker-supplied repositories. Audit hosts where untrusted clones have been attempted for signs that secret-bearing environment variables were sent to external hosts.

Affected
gitpython project gitpythonAll versions before 3.1.52
Estimated exposure
largelikely hundreds of thousands of Python deployments (GitPython has millions of monthly PyPI downloads, though only apps cloning attacker-supplied URLs are… — Estimate based on GitPython's very high PyPI download volume and its common role as a dependency of CI/automation tooling, with the caveat that only deployments that clone untrusted, attacker-controlled URLs take the vulnerable code path.

Order-of-magnitude estimate by the model from install counts, market share and public scan data it knows; verify before quoting.

Description

GitPython before 3.1.52 is vulnerable to environment-variable exfiltration in Repo.clone_from(). The caller-supplied remote URL is passed through Git.polish_url(), which on non-Cygwin platforms calls os.path.expandvars() on the URL before invoking git clone. An attacker who controls the clone URL can embed $NAME or ${NAME} tokens that are expanded to the values of the hosting process's environment variables (e.g., AWS_SECRET_ACCESS_KEY or GITHUB_TOKEN). The resulting URL, now containing the secret, is transmitted over the network to an attacker-controlled host during the clone attempt, disclosing the secret.

Vendors
gitpython project
Products
gitpython
Ecosystems
pip
Weakness
CWE-200
Vector
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:N/VA:N/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X
GHSA
GHSA-rwj8-pgh3-r573 (high)

In the news

No ingested article mentions this CVE yet.