CVE-2026-76220: GitPython before 3.1.58 Command Execution via split_single_char_options

Published Aug 7, 2026
·
Updated

Summary The checkunsafeoptions guard can be bypassed on every guarded method (clone/clonefrom, fetch/pull/push, lsremote, itercommits, blame, archive) by combining a single-character kwarg with splitsinglecharoptions=False. The guard's candidate list omits the smuggled option, but transformkwarg emits a JOINED -n<value> argv token that git parses as --upload-pack=<cmd>, yielding arbitrary command execution at the default allowunsafeoptions=False. This is an incomplete-fix bypass of commit e8d0fbf7 (the fix for GHSA-r9mr-m37c-5fr3), which only emits value-derived candidates when splitsinglecharoptions is True.

Root Cause optioncandidates derives value-token candidates only under if len(key)==1 and splitsinglecharoptions: (cmd.py:1048, added by e8d0fbf7). With splitsinglecharoptions=False, optioncandidates([], {"n":"utouch <cmd>;git-upload-pack"}) returns only ['-n'] (not on the denylist), so the guard passes. But transformkwarg('n', value, splitsinglecharoptions=False) emits the JOINED token -nutouch <cmd>;git-upload-pack (cmd.py:1631). git clusters value-less short flags then parses -u<cmd> = --upload-pack=<cmd> → command execution. The hardened guard WOULD block the joined token if it saw it — the flaw is it never receives it.

Impact Arbitrary OS command execution as the host process (via --upload-pack) at default allowunsafeoptions=False, affecting all guarded methods that forward kwargs. Precondition: the app forwards a user-controlled kwargs dict containing splitsinglecharoptions=False plus a single-char key (same user-dict-forwarding model GHSA-r9mr-m37c-5fr3 accepts).

Proof of Concept python from git import Repo Repo.clonefrom(src, dst, n="utouch /tmp/ACE;git-upload-pack", splitsinglecharoptions=False) # /tmp/ACE created -> ACE

Attack Chain 1. Entry: app forwards user kwargs to Repo.clonefrom(url, path, kwargs): {splitsinglecharoptions: False, n: 'utouch /tmp/ACE;git-upload-pack'}. 2. Check: checkunsafeoptions(optioncandidates([], kwargs), unsafegitcloneoptions). Guard: denylist includes --upload-pack/-u. Bypass proof: optioncandidates yields only ['-n'] (value token skipped because split=False); guard never sees -u. 3. Sink: transformkwarg emits joined token (cmd.py:1631). argv (observed): ['git','clone','-v','-nutouch /tmp/ACE;git-upload-pack','--','<src>','<dst>']. 4. Impact: git clusters -n + -u<cmd> → runs upload-pack command → ACE.

Bypass Evidence Independently reproduced (gate harness, default allowunsafeoptions=False): the split=False payload created the marker VH05GATEACE (ACE); the clone returned normally (guard bypassed). Control: n='--upload-pack=…' (split default True) → UnsafeOptionError: --upload-pack is not allowed. Fix-commit read: e8d0fbf7 extends candidates only under if len(key)==1 and splitsinglecharoptions: — split=False skips value emission. Also confirmed the earlier clustering-parse fix (commit 56806080) does not cover this because the guard only ever receives ['-n'].

Affected Versions GitPython <= 3.1.57 (code present verbatim on the latest release tag).

Suggested Fix Make optioncandidates emit value-derived candidates regardless of splitsinglecharoptions (i.e. also for the joined -n<value> form), OR run checkunsafeoptions over the fully-transformed argv rather than the reconstructed name-only candidate list.

--- Reported by zx (Jace) — GitHub: @manus-use

Other sources

GitPython before 3.1.58 contains a command execution vulnerability in the checkunsafeoptions guard that can be bypassed by combining a single-character kwarg with splitsinglecharoptions=False. Attackers can supply a crafted kwargs dictionary to guarded methods like clonefrom to emit a joined token parsed as --upload-pack, enabling arbitrary OS command execution at default allowunsafeoptions=False.

— NVD

Affected Software

17 affected componentsFixes available
GitPython GitPython<3.1.58
Gitpython Project Gitpython Python<3.1.58
debian/python-git<3.1.30-1+deb12u3
3.1.30-1+deb12u3
debian/python-git<3.1.44-1+deb13u1
3.1.44-1+deb13u1
debian/python-git<3.1.61-1
3.1.61-1
alpine/py3-gitpython<3.1.61-r0
3.1.61-r0
IBM Concert Software<=1.0-3.0.1.1
pip/gitpython<=3.1.57
3.1.58
debian/python-git<=3.1.30-1+deb12u2
3.1.30-1+deb12u33.1.44-1+deb13u13.1.61-1
ubuntu/python-git*
ubuntu/python-git*
ubuntu/python-git*
ubuntu/python-git*
ubuntu/python-git*
ubuntu/python-git*
ubuntu/python-git*
ubuntu/python-git*

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade debian/python-git to a version that resolves this vulnerability.

    Fixed in 3.1.30-1+deb12u3
  2. Upgrade

    Upgrade debian/python-git to a version that resolves this vulnerability.

    Fixed in 3.1.44-1+deb13u1
  3. Upgrade

    Upgrade debian/python-git to a version that resolves this vulnerability.

    Fixed in 3.1.61-1
  4. Upgrade

    Upgrade alpine/py3-gitpython to a version that resolves this vulnerability.

    Fixed in 3.1.61-r0
  5. Upgrade

    Upgrade pip/GitPython to a version that resolves this vulnerability.

    Fixed in 3.1.58
  6. Upgrade

    Upgrade debian/python-git to a version that resolves this vulnerability.

    Fixed in 3.1.30-1+deb12u3Fixed in 3.1.44-1+deb13u1Fixed in 3.1.61-1
  7. Upgrade

    Upgrade to a fixed release to a version that resolves this vulnerability.

    Fixed in 3.1.58

Event History

Aug 7, 2026
Advisory Published
via GitHub·03:49 PM
Data Sourced
via GitHub·03:49 PM
DescriptionSeverityWeaknessAffected Software
Aug 19, 2026
CVE Published
via MITRE·02:02 PM
Data Sourced
via MITRE·02:02 PM
DescriptionSeverityWeakness
Data Sourced
via OSV·02:17 PM
DescriptionSeverityAffected Software
Data Sourced
via NVD·02:17 PM
DescriptionSeverityWeakness
Event
via NVD·02:17 PM
Data Sourced
via Red Hat·02:18 PM
DescriptionSeverityAffected Software
Sep 3, 2026
Data Sourced
via NVD·03:04 PM
Affected Software
Oct 8, 2026
Data Sourced
via IBM·12:00 AM
DescriptionAffected Software
Oct 29, 2026
Updated
via IBM·12:00 AM
Affected Software
Oct 31, 2026
Updated
via OSV·02:00 PM
Affected Software

Parent advisories

This vulnerability appears in the following advisories.

Peer vulnerabilities

Found alongside the following vulnerabilities.

Frequently Asked Questions

1

Who can exploit this issue?

An attacker needs the ability to supply a crafted kwargs dictionary to a GitPython guarded method, such as clone_from. No user interaction is required, but the attacker must have privileges to influence those method arguments.

2

Are default GitPython settings affected?

Yes. The bypass works even when allow_unsafe_options is left at its default value of False, by combining a single-character keyword argument with split_single_char_options=False.

3

What version resolves the issue?

Upgrade GitPython to version 3.1.58 or later. Versions before 3.1.58 are affected according to the advisory information provided.

4

What can be done if an immediate upgrade is not possible?

Do not pass attacker-controlled kwargs to guarded GitPython methods such as clone_from. In particular, prevent callers from controlling split_single_char_options or from supplying crafted single-character option keys that can be joined into unsafe Git options.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203