GitPython: Command Injection via git long-option prefix abbreviation bypass of CVE-2026-42215 blocklist
GitPython contains a command injection vulnerability due to incomplete blocking of unsafe git options. The fix for CVE-2026-42215 implemented a blocklist for dangerous git options but did not account for git's acceptance of unambiguous long-option prefix abbreviations. This allows attackers to bypass the blocklist by using abbreviated option keys, leading to command injection when GitPython emits these options to git commands. The vulnerability affects all versions carrying the 3.1.47 blocklist fix through versions before 3.1.51. Exploitation requires a host application that passes attacker-controlled keyword argument keys to GitPython's clone, fetch, pull, or push methods. The severity is high, reflecting potential remote code execution impact.
AI Analysis
Technical Summary
The vulnerability arises because GitPython's check_unsafe_options method normalizes option names only by converting underscores to hyphens and performs exact dictionary lookups against a blocklist. However, git accepts any unambiguous prefix of a long option as valid, allowing abbreviated keys like 'upload_p' to bypass the blocklist and be passed to git as '--upload-p', which git resolves to the dangerous '--upload-pack' option. This leads to command injection in git clone, fetch, pull, and push operations. The issue affects all GitPython versions from the 3.1.47 blocklist fix through before 3.1.51. The vulnerability inherits the high severity of the parent CVE-2026-42215, with an estimated CVSS vector of AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H. The problem is a classic CWE-184 (Incomplete List of Disallowed Inputs) leading to CWE-78 (OS Command Injection). A proof-of-concept demonstrates remote code execution by passing abbreviated option keys that execute arbitrary commands during git operations.
Potential Impact
Successful exploitation allows an attacker to execute arbitrary commands on the host running GitPython by bypassing the unsafe options blocklist via abbreviated git option prefixes. This can lead to full remote code execution with the privileges of the GitPython process. The impact includes complete confidentiality, integrity, and availability compromise of the affected system. However, exploitation requires that the host application passes attacker-controlled keyword argument keys into GitPython's git command wrappers, which may limit exposure depending on the application context.
Mitigation Recommendations
Patch status is not yet confirmed — check the vendor advisory for current remediation guidance. Until an official fix is released, users should avoid passing untrusted or attacker-controlled keyword argument keys to GitPython's clone, fetch, pull, or push methods. The vulnerability is a bypass of the existing blocklist, so relying on allow_unsafe_options=False alone is insufficient. Monitoring for updates from the GitPython maintainers and applying any forthcoming official fixes is recommended.
GitPython: Command Injection via git long-option prefix abbreviation bypass of CVE-2026-42215 blocklist
Description
GitPython contains a command injection vulnerability due to incomplete blocking of unsafe git options. The fix for CVE-2026-42215 implemented a blocklist for dangerous git options but did not account for git's acceptance of unambiguous long-option prefix abbreviations. This allows attackers to bypass the blocklist by using abbreviated option keys, leading to command injection when GitPython emits these options to git commands. The vulnerability affects all versions carrying the 3.1.47 blocklist fix through versions before 3.1.51. Exploitation requires a host application that passes attacker-controlled keyword argument keys to GitPython's clone, fetch, pull, or push methods. The severity is high, reflecting potential remote code execution impact.
CVSS v3.1
Score 8.8high
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 because GitPython's check_unsafe_options method normalizes option names only by converting underscores to hyphens and performs exact dictionary lookups against a blocklist. However, git accepts any unambiguous prefix of a long option as valid, allowing abbreviated keys like 'upload_p' to bypass the blocklist and be passed to git as '--upload-p', which git resolves to the dangerous '--upload-pack' option. This leads to command injection in git clone, fetch, pull, and push operations. The issue affects all GitPython versions from the 3.1.47 blocklist fix through before 3.1.51. The vulnerability inherits the high severity of the parent CVE-2026-42215, with an estimated CVSS vector of AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H. The problem is a classic CWE-184 (Incomplete List of Disallowed Inputs) leading to CWE-78 (OS Command Injection). A proof-of-concept demonstrates remote code execution by passing abbreviated option keys that execute arbitrary commands during git operations.
Potential Impact
Successful exploitation allows an attacker to execute arbitrary commands on the host running GitPython by bypassing the unsafe options blocklist via abbreviated git option prefixes. This can lead to full remote code execution with the privileges of the GitPython process. The impact includes complete confidentiality, integrity, and availability compromise of the affected system. However, exploitation requires that the host application passes attacker-controlled keyword argument keys into GitPython's git command wrappers, which may limit exposure depending on the application context.
Mitigation Recommendations
Patch status is not yet confirmed — check the vendor advisory for current remediation guidance. Until an official fix is released, users should avoid passing untrusted or attacker-controlled keyword argument keys to GitPython's clone, fetch, pull, or push methods. The vulnerability is a bypass of the existing blocklist, so relying on allow_unsafe_options=False alone is insufficient. Monitoring for updates from the GitPython maintainers and applying any forthcoming official fixes is recommended.
Technical Details
- Gcve Source
- db.gcve.eu
- Osv Id
- GHSA-2f96-g7mh-g2hx
- Osv Schema Version
- 1.4.0
- Aliases
- []
- Ecosystems
- ["PyPI"]
- Database Specific Severity
- HIGH
- Cvss Version
- 3.1
Threat ID: 6a600ac39c2644c7f8fe33a6
Added to database: 07/22/2026, 00:11:47 UTC
Last enriched: 07/22/2026, 00:55:41 UTC
Last updated: 07/31/2026, 12:28:12 UTC
Views: 35
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.