CVE-2026-67323
PoC ×2largeCommand injection in GitPython before 3.1.51 via unguarded Git options
GitPython before 3.1.51, a widely used Python library for interacting with Git repositories, does not guard caller-supplied keyword arguments before building git command lines, so option-shaped values such as --exec or --upload-pack passed to Repo.archive() or git.ls_remote() are interpreted by Git itself, enabling command injection and arbitrary command execution. Additionally, Repo.iter_commits() and Repo.blame() do not check revision arguments for a leading dash, so a revision such as --output=<path> causes Git to open and truncate an arbitrary file. An attacker must be able to control arguments an application passes into these methods, and gains execution of arbitrary commands with the privileges of the Python process or destruction of arbitrary files. Any Python application or service running GitPython earlier than 3.1.51 and forwarding attacker-controlled input to these APIs is affected, while applications using only fixed, hardcoded arguments are not meaningfully exposed. No in-the-wild exploitation is confirmed (not in CISA KEV, EPSS about 1%), but public advisories and proof-of-concept references are available.
What to do: Upgrade to GitPython 3.1.51 or later. As an interim mitigation, validate or sanitize any attacker-controlled values before they reach Repo.archive(), git.ls_remote(), Repo.iter_commits() or Repo.blame(), rejecting arguments that begin with a dash (e.g., --exec, --upload-pack, --output=). Audit code paths where user input flows into these APIs to confirm whether your deployment is actually exposed.
| gitpython project GitPython | all versions before 3.1.51 |
Order-of-magnitude estimate by the model from install counts, market share and public scan data it knows; verify before quoting.
GitPython before 3.1.51 fails to guard against dangerous Git options passed as keyword arguments in Repo.archive() and git.ls_remote(), allowing command injection via options such as --exec/--upload-pack (leading to arbitrary command execution). Additionally, Repo.iter_commits() and Repo.blame() do not check for leading-dash revision arguments, so a revision like --output= can cause Git to open and truncate an arbitrary file. Exploitation requires an application that passes attacker-controlled arguments to these methods.
- Vendors
- gitpython project
- Products
- gitpython
- Ecosystems
- pip
- Weakness
- CWE-77
- Vector
- CVSS:4.0/AV:L/AC:L/AT:N/PR:N/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X
- GHSA
- GHSA-956x-8gvw-wg5v (high)
In the news0 stories
No ingested article mentions this CVE yet.