Junglewise Threat Intelligence

GitPython command injection via git long-option prefix abbreviation bypass

Severity: high · CVSS 8.8 · Published 2026-08-01

Technologies: GitPython Developers Gitpython.

Executive brief

GitPython is a Python library used by many applications to interact with Git repositories. It implements a blocklist to prevent attackers from passing dangerous git options that could lead to command execution. This vulnerability allows attackers to bypass that blocklist by using abbreviated option names (like `upload_p` instead of `upload_pack`), which Git then resolves and executes, enabling arbitrary command execution on systems using affected GitPython versions.

Technical details

The vulnerability stems from an incomplete fix to CVE-2026-42215. GitPython's check_unsafe_options() method canonicalizes option names by converting underscores to hyphens and performs exact-match lookups against a blocklist of dangerous git options (--upload-pack, --receive-pack, --config, --exec, etc.). However, Git's CLI parser accepts unambiguous prefix abbreviations of long options—so `--upload-p`, `--upload-pa`, and `--upload-pac` all resolve to `--upload-pack`. The guard does not model this abbreviation grammar, allowing shortened kwarg keys like `upload_p` to pass validation and reach git as `--upload-p=<value>`, which is then resolved to the blocked `--upload-pack` option. Exploitation requires a host application that flows attacker-controlled kwarg keys into GitPython's clone, fetch, pull, or push methods with the default `allow_unsafe_options=False` setting. The fix is available in GitPython 3.1.51 and later.

Affected products

  • GitPython Developers GitPython < 3.1.51

Timeline

  • 2026-07-12: disclosed: Original advisory GHSA-2f96-g7mh-g2hx published
  • 2026-08-01: disclosed: Duplicate advisory GHSA-6r2r-ww24-7h52 published; CVE-2026-67325 assigned by NVD
  • 2026-09-08: other: GHSA-6r2r-ww24-7h52 withdrawn as duplicate of GHSA-2f96-g7mh-g2hx
  • 2026: patched: Fix available in GitPython 3.1.51

References