GitPython: Unsafe git option guard bypass via split_single_char_options=False short-option token smuggling enables command execution
GitPython versions up to 3.1.57 contain a vulnerability where the unsafe git option guard can be bypassed by using the split_single_char_options=False flag combined with a single-character keyword argument. This allows an attacker to smuggle a short option token that leads to arbitrary OS command execution via the git --upload-pack option. The vulnerability affects all guarded methods that forward kwargs and occurs despite the default allow_unsafe_options=False setting. A patch is available to fix this issue.
AI Analysis
Technical Summary
The vulnerability arises because the _option_candidates function only derives value-token candidates when split_single_char_options is True. When set to False, the guard's candidate list omits the smuggled option, allowing the transform_kwarg function to emit a joined token that git interprets as a --upload-pack command, enabling arbitrary command execution. This bypasses the existing unsafe option guard implemented in commit e8d0fbf7, which only checks candidates when split_single_char_options is True. The flaw affects all guarded GitPython methods that forward kwargs and use split_single_char_options=False with a single-character key. The vulnerability is present in GitPython versions up to and including 3.1.57.
Potential Impact
An attacker who can control kwargs passed to GitPython methods such as clone, fetch, pull, push, ls_remote, iter_commits, blame, or archive and set split_single_char_options=False with a crafted single-character option can achieve arbitrary OS command execution on the host running the GitPython process. This occurs despite the default allow_unsafe_options=False setting, as the unsafe option guard is bypassed due to incomplete candidate detection. The impact includes full confidentiality, integrity, and availability compromise of the host system via command execution.
Mitigation Recommendations
A patch is available that corrects the _option_candidates function to emit value-derived candidates regardless of the split_single_char_options flag, or alternatively runs the unsafe option guard over the fully transformed argv tokens rather than the reconstructed candidate list. Users should upgrade GitPython to version 3.1.58 or later where this issue is fixed. Until patched, avoid passing split_single_char_options=False with user-controlled single-character kwargs to guarded GitPython methods.
GitPython: Unsafe git option guard bypass via split_single_char_options=False short-option token smuggling enables command execution
Description
GitPython versions up to 3.1.57 contain a vulnerability where the unsafe git option guard can be bypassed by using the split_single_char_options=False flag combined with a single-character keyword argument. This allows an attacker to smuggle a short option token that leads to arbitrary OS command execution via the git --upload-pack option. The vulnerability affects all guarded methods that forward kwargs and occurs despite the default allow_unsafe_options=False setting. A patch is available to fix this issue.
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.
Weaknesses
AI-Powered Analysis
Machine-generated threat intelligence
Technical Analysis
The vulnerability arises because the _option_candidates function only derives value-token candidates when split_single_char_options is True. When set to False, the guard's candidate list omits the smuggled option, allowing the transform_kwarg function to emit a joined token that git interprets as a --upload-pack command, enabling arbitrary command execution. This bypasses the existing unsafe option guard implemented in commit e8d0fbf7, which only checks candidates when split_single_char_options is True. The flaw affects all guarded GitPython methods that forward kwargs and use split_single_char_options=False with a single-character key. The vulnerability is present in GitPython versions up to and including 3.1.57.
Potential Impact
An attacker who can control kwargs passed to GitPython methods such as clone, fetch, pull, push, ls_remote, iter_commits, blame, or archive and set split_single_char_options=False with a crafted single-character option can achieve arbitrary OS command execution on the host running the GitPython process. This occurs despite the default allow_unsafe_options=False setting, as the unsafe option guard is bypassed due to incomplete candidate detection. The impact includes full confidentiality, integrity, and availability compromise of the host system via command execution.
Mitigation Recommendations
A patch is available that corrects the _option_candidates function to emit value-derived candidates regardless of the split_single_char_options flag, or alternatively runs the unsafe option guard over the fully transformed argv tokens rather than the reconstructed candidate list. Users should upgrade GitPython to version 3.1.58 or later where this issue is fixed. Until patched, avoid passing split_single_char_options=False with user-controlled single-character kwargs to guarded GitPython methods.
Technical Details
- Gcve Source
- db.gcve.eu
- Osv Id
- GHSA-wvpp-8hx9-p66j
- Osv Schema Version
- 1.4.0
- Aliases
- []
- Ecosystems
- ["PyPI"]
- Database Specific Severity
- HIGH
- Cvss Version
- 3.1
Threat ID: 6a77432fbf8831d539b4628c
Added to database: 08/08/2026, 14:54:39 UTC
Last enriched: 08/08/2026, 15:40:58 UTC
Last updated: 08/09/2026, 00:43:20 UTC
Views: 8
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.