Advisory Database
  • Advisories
  • Dependency Scanning
  1. pypi
  2. ›
  3. GitPython
  4. ›
  5. GHSA-rwj8-pgh3-r573

GHSA-rwj8-pgh3-r573: GitPython: Environment-variable exfiltration via os.path.expandvars() on Repo.clone_from() URL

July 21, 2026

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/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

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. Learn more about Dependency Scanning →

Affected versions

All versions before 3.1.52

Fixed versions

  • 3.1.52

Solution

Upgrade to version 3.1.52 or above.

Impact 7.5 HIGH

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:N/A:N

Learn more about CVSS

Weakness

  • CWE-200: Exposure of Sensitive Information to an Unauthorized Actor
  • CWE-201: Insertion of Sensitive Information Into Sent Data

Source file

pypi/GitPython/GHSA-rwj8-pgh3-r573.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Wed, 22 Jul 2026 00:18:03 +0000.