Executive brief
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.
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