Executive brief
GitPython is a Python library used to interact with Git repositories. A security flaw in version 3.1.50 allows an attacker to bypass safety checks and execute arbitrary commands on the system when the library is used to clone a repository. This could lead to full system compromise if an application processes untrusted repository options.
Technical details
A vulnerability exists in GitPython 3.1.50 where the internal 'unsafe-option gate' fails to recognize joined short-option forms such as '-u<path>' or '-c<key>=<value>'. While long-form options like '--upload-pack' are correctly blocked, the '_canonicalize_option_name' function does not properly strip values from short options before validation. An attacker who can influence the 'multi_options' parameter in 'Repo.clone_from()' can bypass the 'allow_unsafe_options=False' default protection to execute local commands via Git's upload-pack or config mechanisms. This issue is fixed in version 3.1.51.
Affected products
- gitpython-developers GitPython 3.1.50
Timeline
- 2026-07-12: disclosed
- 2026-07-21: advisory
- 3.1.51: patched