GitPython unsafe clone option gate bypass through joined short options

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<helper> instead of --upload-pack=<helper>), allowing them to execute arbitrary commands on a system performing a Git clone with attacker-controlled options.

Technologies: Gitpython Project Gitpython. 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<value> as option name "u<value>" rather than matching it against the blocked short option "u". Since Git itself accepts -u<upload-pack> as a valid short form of --upload-pack=<upload-pack>, 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

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.