Executive brief
GitPython is a Python library used to interact with Git repositories. A vulnerability exists where the library automatically expands environment variables within repository URLs provided by a user. An attacker can provide a specially crafted URL that, when processed, embeds sensitive system secrets (like AWS keys or API tokens) into the repository configuration and transmits them to the attacker's server during subsequent network operations.
Technical details
This vulnerability is an incomplete fix for GHSA-rwj8-pgh3-r573. While the previous fix addressed Repo.clone_from(), the Remote.create(), Repo.create_remote(), and Submodule.add() functions still pass user-supplied URLs to Git.polish_url() with expand_vars=True by default. This causes os.path.expandvars() to be called on the URL, allowing an attacker to use shell-style variable syntax (e.g., ${VAR}) to leak environment variables. The expanded URL containing the secret is then written to the .git/config or .gitmodules file and exfiltrated to the attacker-controlled host during the next fetch, pull, or remote update operation. The vulnerability is patched in version 3.1.55 by disabling variable expansion in these callers.
Affected products
- gitpython-developers GitPython <= 3.1.53
Timeline
- 2026-07-23: disclosed
- 2026-07-24: advisory: GitHub Advisory GHSA-94p4-4cq8-9g67 published.
- 2026-07-24: patched: Version 3.1.55 released.