Executive brief
GitPython is a Python library used to interact with Git repositories. A flaw in GitPython's argument validation allows attackers to bypass safety checks and execute arbitrary system commands on machines running applications that use GitPython. This could allow an attacker to take complete control of the affected system and access or modify sensitive data.
Technical details
The vulnerability is an argument injection flaw (CWE-88) in the check_unsafe_options guard used by GitPython's command construction. The guard is designed to prevent dangerous git options like --upload-pack from being passed to git commands. However, by supplying a single-character kwarg combined with split_single_char_options=False, an attacker can cause transform_kwarg to emit a joined token (e.g., -nutouch /tmp/ACE;git-upload-pack) that the guard never validates because _option_candidates only generates the short form ['-n']. The git command parser then interprets this as --upload-pack=<cmd>, achieving arbitrary command execution. The vulnerability affects all guarded methods (clone_from, fetch, pull, push, ls_remote, iter_commits, blame, archive) and requires only that the application forwards user-controlled kwargs to these methods—a pattern already accepted by the library. The fix is available in GitPython 3.1.58.
Affected products
- GitPython developers GitPython <= 3.1.57
Timeline
- 2026-08-04: disclosed
- 2026-08-19: patched: GitPython 3.1.58 released with fix