# GitPython command injection via unguarded Git options in archive and ls_remote

Source: https://junglewise.ai/threats/gitpython-command-injection-via-unguarded-git-options-in-archive-and-ls-d903ac45  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-08-01. Updated: 2026-09-25  
License: CC BY 4.0 with a link back

Severity: high · CVSS 8.4 · Published 2026-08-01

GitPython is a Python library that provides access to Git repositories. The library fails to properly validate user-supplied keyword arguments passed to Git commands in several methods (Repo.archive(), git.ls_remote(), Repo.iter_commits(), and Repo.blame()), allowing attackers to inject arbitrary Git options. This can lead to arbitrary command execution or truncation of arbitrary files on the system, provided the application passes untrusted user input to these methods.

Technologies: [Gitpython Project Gitpython](https://junglewise.ai/threats/technologies/gitpython). Vendors: [Gitpython Project](https://junglewise.ai/threats/vendors/gitpython-project).

## Quick answers

**Is This vulnerability exploited in the wild?** No. Junglewise Threat Intelligence has no report of This vulnerability being exploited in the wild.

**How severe is This vulnerability?** High severity, with a CVSS score of 8.4, published 1 August 2026.

**Which products and versions are affected?** Gitpython Project Gitpython <= 3.1.50.

**Is there a fix for This vulnerability?** A patch was published on 2026-07-12: Fix released in GitPython 3.1.51 Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is This vulnerability attacked?** It is attacked with local access, in a software library.

**Am I affected?** Check whether you run Gitpython Project Gitpython at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## Technical details

GitPython constructs Git command arguments dynamically from caller-supplied keyword arguments without properly sanitizing them. In Repo.archive() and git.ls_remote(), dangerous Git options like --exec and --upload-pack are transformed from kwargs and injected before the -- argument separator, enabling command injection vectors (e.g., --exec to specify an arbitrary binary, --remote to spawn upload-archive helper). In Repo.iter_commits() and Repo.blame(), revision arguments are passed before the -- separator without validation for leading dashes, allowing options like --output=<path> to cause Git to open and truncate arbitrary files before the revision is even validated. The vulnerability only affects applications that directly pass attacker-controlled dictionaries or user input as method arguments. The fix is available in GitPython 3.1.51 and later.

## Affected products

- GitPython GitPython <= 3.1.50

## Timeline

- 2026-07-12: disclosed: Original advisory GHSA-956x-8gvw-wg5v published
- 2026-08-01: disclosed: Duplicate advisory GHSA-4vpg-pfj8-m33q published; CVE-2026-67323 assigned
- 2026-07-12: patched: Fix released in GitPython 3.1.51
- 2026-09-08: other: GHSA-4vpg-pfj8-m33q withdrawn as duplicate of GHSA-956x-8gvw-wg5v

## References

- [https://github.com/gitpython-developers/GitPython/security/advisories/GHSA-956x-8gvw-wg5v](https://github.com/gitpython-developers/GitPython/security/advisories/GHSA-956x-8gvw-wg5v)
- [https://www.vulncheck.com/advisories/gitpython-before-command-injection-via-unguarded-git-options](https://www.vulncheck.com/advisories/gitpython-before-command-injection-via-unguarded-git-options)

## Related threats

- [GitPython ReDoS via catastrophic backtracking in Actor.name_email_regex](https://junglewise.ai/threats/cve-2026-87819-gitpython-redos-via-catastrophic-backtracking-in-actor-name-email)
- [GitPython argument injection in diff API via --no-index](https://junglewise.ai/threats/cve-2026-87818-gitpython-argument-injection-in-diff-api-via-no-index)
- [GitPython git directory impersonation leading to code execution](https://junglewise.ai/threats/cve-2026-87817-gitpython-git-directory-impersonation-leading-to-code-execution)
- [GitPython path traversal in clone_from() and clone() via --separate-git-dir](https://junglewise.ai/threats/gitpython-path-traversal-in-clone-from-and-clone-via-separate-git-dir-76bb0c2e)
- [GitPython arbitrary file read in Repo.blame via incomplete option denylist](https://junglewise.ai/threats/cve-2026-78678-gitpython-arbitrary-file-read-in-repo-blame-via-incomplete-option)
