CVE-2026-67323
GitPython 3.1.51+ allows command injection via unsafe Git options and revision arguments.
- CVSS 8.6
- CWE-77
- Input Validation and Sanitization
- Remote
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.
- CWE
- CWE-77
- CVSS base score
- 8.6
- Published
- 2026-08-01
- OWASP
- A03 Injection
- Orthogonal defect classification
- Checking
- Code defect classification
- Missing Check
- Category
- Input Validation and Sanitization
- Subcategory
- Command Injection
- Accessibility scope
- Remote
- Impact
- Arbitrary Code Execution
- Affected component
- GitPython
- Fixed by upgrading
- Yes
Solution
Upgrade GitPython to 3.1.51 or newer.
Vulnerable code sample
import git
def create_archive(repo_path, fmt, output_path, **options):
"""
Create a git archive using user‑controlled options.
"""
repo = git.Repo(repo_path)
# VULNERABLE: passes unchecked keyword arguments to git archive
repo.archive(output_path, fmt=fmt, **options)Patched code sample
import git
def create_archive(repo_path, fmt, output_path, **options):
"""
Create a git archive after sanitising user‑controlled options.
"""
repo = git.Repo(repo_path)
# FIX: drop any option whose name starts with a dash to prevent command injection
safe_opts = {k: v for k, v in options.items() if not k.lstrip().startswith('-')}
repo.archive(output_path, fmt=fmt, **safe_opts)Published fix
Public sources link this CVE to the changes below. The code samples above were generated to illustrate the defect; these links lead to the code the project actually changed.
- fix: Guard unsafe git command options (GHSA-956x-8gvw-wg5v) (gitpython-developers/GitPython)
git/cmd.py,git/cmd.py · Git._unpack_args,git/objects/commit.py,git/objects/commit.py · Commit.iter_items,git/remote.py · Remote.fetch,git/remote.py · Remote.pull,git/remote.py · Remote.push,git/repo/base.py,git/repo/base.py · Repo.archive,git/repo/base.py · Repo.blame,git/repo/base.py · Repo.blame_incremental,git/repo/base.py · Repo.iter_commitsand 1 more
Cite this entry
@misc{vaitp:cve202667323,
title = {{GitPython 3.1.51+ allows command injection via unsafe Git options and revision arguments.}},
author = {Bogaerts, Fr\'ed\'eric and Ivaki, Naghmeh and Fonseca, Jos\'e},
year = {2026},
note = {VAITP Python Vulnerability Dataset, entry CVE-2026-67323},
howpublished = {\url{https://netpack.pt/vaitp/vulnerability/CVE-2026-67323/}}
}
Introducing the "VAITP dataset": a specialized repository of Python vulnerabilities and patches, meticulously compiled for the use of the security research community. As Python's prominence grows, understanding and addressing potential security vulnerabilities become crucial. Crafted by and for the cybersecurity community, this dataset offers a valuable resource for researchers, analysts, and developers to analyze and mitigate the security risks associated with Python. Through the comprehensive exploration of vulnerabilities and corresponding patches, the VAITP dataset fosters a safer and more resilient Python ecosystem, encouraging collaborative advancements in programming security.
The supreme art of war is to subdue the enemy without fighting.
Sun Tzu – “The Art of War”
:: Shaping the future through research and ingenuity ::
