GitPython: Environment-variable exfiltration via Repo.create_remote() / Remote.add() URL (incomplete fix of GHSA-rwj8-pgh3-r573)
GitPython versions prior to 3.1.55 contain a vulnerability where environment variables in URLs passed to Repo.create_remote() or Remote.add() are expanded and embedded into the repository configuration. This occurs because the fix for a prior vulnerability did not cover these API calls, leaving the default behavior to expand environment variables in URLs. As a result, sensitive environment secrets can be exfiltrated by embedding them in URLs that are stored in .git/config and transmitted to attacker-controlled hosts during fetch or pull operations.
AI Analysis
Technical Summary
The vulnerability arises from the Git.polish_url() method's default behavior of expanding environment variables in URLs (expand_vars=True). While the prior fix disabled this expansion for Repo.clone_from(), it did not update Repo.create_remote() or Remote.add(), which still expand variables in attacker-controlled URLs. An attacker can supply a URL containing environment variable references (e.g., ${AWS_SECRET_ACCESS_KEY}), which are expanded on the server side and stored in the repository's .git/config file. Subsequent fetch or pull operations transmit the expanded secret to the attacker's server. The check for unsafe protocols occurs after expansion and does not block HTTPS URLs carrying secrets. This issue affects GitPython versions before 3.1.55.
Potential Impact
Sensitive environment variables from the hosting process can be exposed to an attacker by embedding them in URLs passed to Repo.create_remote() or Remote.add(). These secrets are written into the repository configuration and transmitted over the network during Git fetch or pull operations, leading to confidentiality breaches. There is no impact on integrity or availability reported.
Mitigation Recommendations
Patch status is not yet confirmed — check the vendor advisory for current remediation guidance. Until an official fix is released, avoid using Repo.create_remote() or Remote.add() with untrusted URLs containing environment variable expansions. Monitor GitPython releases for updates that disable environment variable expansion in these API calls, similar to the fix applied to Repo.clone_from().
GitPython: Environment-variable exfiltration via Repo.create_remote() / Remote.add() URL (incomplete fix of GHSA-rwj8-pgh3-r573)
Description
GitPython versions prior to 3.1.55 contain a vulnerability where environment variables in URLs passed to Repo.create_remote() or Remote.add() are expanded and embedded into the repository configuration. This occurs because the fix for a prior vulnerability did not cover these API calls, leaving the default behavior to expand environment variables in URLs. As a result, sensitive environment secrets can be exfiltrated by embedding them in URLs that are stored in .git/config and transmitted to attacker-controlled hosts during fetch or pull operations.
CVSS v3.1
Affected software
Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
The vulnerability arises from the Git.polish_url() method's default behavior of expanding environment variables in URLs (expand_vars=True). While the prior fix disabled this expansion for Repo.clone_from(), it did not update Repo.create_remote() or Remote.add(), which still expand variables in attacker-controlled URLs. An attacker can supply a URL containing environment variable references (e.g., ${AWS_SECRET_ACCESS_KEY}), which are expanded on the server side and stored in the repository's .git/config file. Subsequent fetch or pull operations transmit the expanded secret to the attacker's server. The check for unsafe protocols occurs after expansion and does not block HTTPS URLs carrying secrets. This issue affects GitPython versions before 3.1.55.
Potential Impact
Sensitive environment variables from the hosting process can be exposed to an attacker by embedding them in URLs passed to Repo.create_remote() or Remote.add(). These secrets are written into the repository configuration and transmitted over the network during Git fetch or pull operations, leading to confidentiality breaches. There is no impact on integrity or availability reported.
Mitigation Recommendations
Patch status is not yet confirmed — check the vendor advisory for current remediation guidance. Until an official fix is released, avoid using Repo.create_remote() or Remote.add() with untrusted URLs containing environment variable expansions. Monitor GitPython releases for updates that disable environment variable expansion in these API calls, similar to the fix applied to Repo.clone_from().
Technical Details
- Gcve Source
- db.gcve.eu
- Osv Id
- GHSA-94p4-4cq8-9g67
- Osv Schema Version
- 1.4.0
- Aliases
- []
- Ecosystems
- ["PyPI"]
- Database Specific Severity
- HIGH
- Cvss Version
- 3.1
Threat ID: 6a6542259c2644c7f8089cfa
Added to database: 07/25/2026, 23:09:25 UTC
Last enriched: 07/25/2026, 23:53:02 UTC
Last updated: 07/26/2026, 03:54:41 UTC
Views: 5
Community Reviews
0 reviewsCrowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.
Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.
Actions
Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.
Need more coverage?
Upgrade to Pro Console for AI refresh and higher limits.
For incident response and remediation, OffSeq services can help resolve threats faster.
Latest Threats
Check if your credentials are on the dark web
Instant breach scanning across billions of leaked records. Free tier available.