Executive brief
GitPython is a popular library that applications use to interact with Git repositories programmatically. A vulnerability in its safety checks allows attackers to bypass security controls and execute arbitrary commands on the host system by smuggling malicious Git options into method parameters. This can lead to complete system compromise if an application accepts user input for Git operations.
Technical details
GitPython contains an OS command injection vulnerability (CWE-78) in the check_unsafe_options guard, which is designed to prevent dangerous Git options from being passed to Git commands. The guard only inspects kwarg keys but fails to validate kwarg values. Attackers can smuggle a dangerous Git option like --upload-pack into a single-character kwarg value; when transformed into argv tokens, the smuggled option becomes a separate token that the guard never inspected. The vulnerability is exploitable by calling affected methods (clone_from, fetch, pull, push, ls_remote, iter_commits, blame, archive) with crafted options, requiring low privileges and no user interaction. Arbitrary OS command execution is achieved via the --upload-pack parameter. The vulnerability is patched in GitPython 3.1.54 and later.
Affected products
- GitPython GitPython < 3.1.54
Timeline
- 2026-07-22: disclosed
- 2026-08-13: advisory
- 2026: patched: Fixed in version 3.1.54