Executive brief
GitPython is a popular Python library used to interact with Git repositories. A vulnerability in how the library handles command-line arguments allows an attacker to bypass security guards and execute arbitrary commands on the host system. This could lead to a full system compromise, unauthorized data access, or service disruption if the application processes user-supplied repository options.
Technical details
An argument injection vulnerability exists in GitPython's `check_unsafe_options` guard. When a single-character keyword argument is used with `split_single_char_options=False`, the `_option_candidates` function fails to include the value-derived tokens in its security check. However, `transform_kwarg` subsequently emits a joined token (e.g., `-n<value>`) which Git interprets as a clustered short option. An attacker can smuggle the `-u` or `--upload-pack` option within this joined token to achieve arbitrary command execution. This is a bypass of the fix for GHSA-r9mr-m37c-5fr3. The issue is resolved in version 3.1.58.
Affected products
- gitpython-developers GitPython <= 3.1.57
Timeline
- 2026-08-04: patched: Fix released in version 3.1.58
- 2026-08-07: advisory: GitHub Advisory GHSA-wvpp-8hx9-p66j published