CVE-2026-67322

GitPython before 3.1.52 Environment Variable Exfiltration via clone_from

Published Aug 1, 2026 CVSS 4.0 · 8.7 High EPSS < 1% KEV · Not listed
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.

Analysis

AI-generated

Technical impact

GitPython versions prior to 3.1.52 allow an attacker who can influence the clone URL to embed environment variable expansion tokens such as $NAME or ${NAME}. When the URL is processed by Git.polish_url(), the implementation on non‑Cygwin platforms calls os.path.expandvars(), which expands these tokens to the values of environment variables in the host process. The resulting URL, now containing the expanded values, is transmitted over the network to the target repository location. If the repository host is controlled by the attacker, the expanded secrets—such as AWS_SECRET_ACCESS_KEY or GITHUB_TOKEN—are exposed remotely, leading to a confidentiality breach of sensitive credentials. The weakness is classified as CWE‑200 and CWE‑214, reflecting unauthorized disclosure of information. The vulnerability is exploited via normal clone operations; an attacker does not need elevated privileges beyond the ability to supply a malicious URL to a process executing Repo.clone_from().

Affected Systems

The affected product is GitPython, maintained by gitpython-developers. All releases earlier than version 3.1.52 are vulnerable. The issue arises on environments that are not Cygwin, as the indirect call to os.path.expandvars() occurs only in those contexts. Users of this library in CI/CD pipelines, development tools, or any scripts that perform remote repository cloning are at risk if their application permits untrusted URLs.

Risk and Exploitability

The CVSS score of 8.7 places this flaw in the high severity range. The EPSS score of 0.00266 (0.266%) indicates a low but non‑zero probability of exploitation, meaning that while attacks are unlikely, the potential impact remains high. The vulnerability is not currently listed in the CISA KEV catalog, indicating no publicly known, actively exploited instances at the time of assessment. Attackers can feasibly target systems that run GitPython in environments where environment variables contain high‑value secrets. The exploit is straightforward: supply a crafted clone URL to the vulnerable process and observe the exfiltrated secret in the outbound network connection.

Remediation

No solution or workaround provided in the CVE record.

OpenCVE Recommended Actions

  • Upgrade GitPython to version 3.1.52 or newer, which removes the use of os.path.expandvars() when processing clone URLs.
  • If an upgrade is not immediately possible, sanitize the clone URL by escaping environment variable delimiters—e.g., replace $ with \$ or use literal URLs—before passing it to Repo.clone_from().
  • Limit the environment in which GitPython runs by clearing or restricting sensitive environment variables, ensuring that even if variable expansion occurs, no valuable secrets are exposed.

Generated by OpenCVE AI on August 4, 2026 at 22:13 UTC.

Tracking

Sign in to view the affected projects.

Advisories

Source ID Title
Debian DLA Debian DLA DLA-4872-1 python-git security update
Github GHSA Github GHSA GHSA-rwj8-pgh3-r573 GitPython: Environment-variable exfiltration via os.path.expandvars() on Repo.clone_from() URL
History
Type Values Removed Values Added
First Time appeared Gitpython Project
Gitpython Project gitpython
CPEs cpe:2.3:a:gitpython_project:gitpython:*:*:*:*:*:python:*:*
Vendors & Products Gitpython Project
Gitpython Project gitpython
Type Values Removed Values Added
Metrics ssvc

{'options': {'Automatable': 'yes', 'Exploitation': 'poc', 'Technical Impact': 'partial'}, 'version': '2.0.3'}

Type Values Removed Values Added
First Time appeared Gitpython-developers
Gitpython-developers gitpython
Vendors & Products Gitpython-developers
Gitpython-developers gitpython
Type Values Removed Values Added
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.
Title GitPython before 3.1.52 Environment Variable Exfiltration via clone_from
Weaknesses CWE-200
References
Metrics cvssV3_1

{'score': 7.5, 'vector': 'CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N'}

cvssV4_0

{'score': 8.7, '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'}

Weaknesses
  • CWE-200

    Exposure of Sensitive Information to an Unauthorized Actor

  • CWE-214

    Invocation of Process Using Visible Sensitive Information

Sources

Status
PUBLISHED
Assigner
VulnCheck
Published
Updated
Aug 14, 2026, 4:50 PM
Reserved
Jul 29, 2026, 1:07 PM
Status
Analyzed
Published
Aug 1, 2026, 1:17 PM
Modified
Oct 23, 2026, 11:10 PM
Severity
Important
Public date
Aug 1, 2026, 12:22 PM