# GitPython unsafe clone option gate bypass through joined short options

Source: https://junglewise.ai/threats/gitpython-unsafe-clone-option-gate-bypass-through-joined-short-options-627f633b  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-08-01. Updated: 2026-09-25  
License: CC BY 4.0 with a link back

Severity: critical · CVSS 9.8 · Published 2026-08-01

GitPython is a Python library for interacting with Git repositories. GitPython's security gate is designed to block dangerous Git clone options (like --upload-pack) when applications don't explicitly allow unsafe options. However, an attacker can bypass this protection by using a variant form of the dangerous option (-u&lt;helper&gt; instead of --upload-pack=&lt;helper&gt;), allowing them to execute arbitrary commands on a system performing a Git clone with attacker-controlled options.

Technologies: [Gitpython Project Gitpython](https://junglewise.ai/threats/technologies/gitpython). Vendors: [Gitpython Project](https://junglewise.ai/threats/vendors/gitpython-project).

## Quick answers

**Is This vulnerability exploited in the wild?** No. Junglewise Threat Intelligence has no report of This vulnerability being exploited in the wild.

**How severe is This vulnerability?** Critical severity, with a CVSS score of 9.8, published 1 August 2026.

**Which products and versions are affected?** Gitpython Project Gitpython 3.1.50.

**Is there a fix for This vulnerability?** A patch was published on 2026-08-01: Fixed in GitPython 3.1.51 Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is This vulnerability attacked?** It is attacked over the network, in a software library.

**Am I affected?** Check whether you run Gitpython Project Gitpython at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## Technical details

This is an OS command injection vulnerability (CWE-78) in the option validation logic of GitPython's Repo.clone_from() method. The vulnerable component is the _canonicalize_option_name() function which fails to properly parse joined short options. When GitPython checks multi_options against the unsafe-option gate, it canonicalizes option names, but incorrectly treats -u&lt;value&gt; as option name "u&lt;value&gt;" rather than matching it against the blocked short option "u". Since Git itself accepts -u&lt;upload-pack&gt; as a valid short form of --upload-pack=&lt;upload-pack&gt;, the malformed canonicalization allows the bypass. An attacker must be able to control the multi_options parameter passed to Repo.clone_from() while the application relies on the default allow_unsafe_options=False gate to prevent execution. The attack succeeds over the network if the application clones repositories with attacker-influenced options. The vulnerability was fixed in GitPython 3.1.51 by improving the option parsing to recognize all forms of joined short options.

## Affected products

- GitPython GitPython 3.1.50

## Timeline

- 2026-08-01: disclosed: Published to GitHub Advisory Database (GHSA-v396-v7q4-x2qj primary advisory)
- 2026-08-01: patched: Fixed in GitPython 3.1.51

## References

- [https://github.com/gitpython-developers/GitPython/security/advisories/GHSA-v396-v7q4-x2qj](https://github.com/gitpython-developers/GitPython/security/advisories/GHSA-v396-v7q4-x2qj)
- [https://www.vulncheck.com/advisories/gitpython-authentication-bypass-via-joined-short-options](https://www.vulncheck.com/advisories/gitpython-authentication-bypass-via-joined-short-options)

## Related threats

- [GitPython ReDoS via catastrophic backtracking in Actor.name_email_regex](https://junglewise.ai/threats/cve-2026-87819-gitpython-redos-via-catastrophic-backtracking-in-actor-name-email)
- [GitPython argument injection in diff API via --no-index](https://junglewise.ai/threats/cve-2026-87818-gitpython-argument-injection-in-diff-api-via-no-index)
- [GitPython git directory impersonation leading to code execution](https://junglewise.ai/threats/cve-2026-87817-gitpython-git-directory-impersonation-leading-to-code-execution)
- [GitPython path traversal in clone_from() and clone() via --separate-git-dir](https://junglewise.ai/threats/gitpython-path-traversal-in-clone-from-and-clone-via-separate-git-dir-76bb0c2e)
- [GitPython arbitrary file read in Repo.blame via incomplete option denylist](https://junglewise.ai/threats/cve-2026-78678-gitpython-arbitrary-file-read-in-repo-blame-via-incomplete-option)
