CVE-2026-67323 Overview
CVE-2026-67323 is a command injection vulnerability in GitPython versions before 3.1.51. The library fails to guard against dangerous Git options passed as keyword arguments in Repo.archive() and git.ls_remote(). Attackers can inject options such as --exec or --upload-pack to achieve arbitrary command execution. A related flaw allows Repo.iter_commits() and Repo.blame() to accept revision arguments beginning with a dash, letting a value like --output=<path> cause Git to open and truncate an arbitrary file. Exploitation requires an application that forwards attacker-controlled arguments to these methods.
Critical Impact
Arbitrary command execution and arbitrary file truncation in applications embedding GitPython when attacker-controlled input reaches vulnerable methods.
Affected Products
- GitPython versions before 3.1.51
- Python applications embedding GitPython that pass user input to Repo.archive() or git.ls_remote()
- Python applications embedding GitPython that pass user input to Repo.iter_commits() or Repo.blame()
Discovery Timeline
- 2026-08-01 - CVE-2026-67323 published to NVD
- 2026-08-05 - Last updated in NVD database
Technical Details for CVE-2026-67323
Vulnerability Analysis
GitPython is a Python library that wraps the git command-line binary. The vulnerability stems from missing sanitization of keyword arguments in Repo.archive() and git.ls_remote(). These methods translate keyword arguments directly into Git command-line options. When an application forwards untrusted input as a keyword, an attacker can supply Git options that execute arbitrary programs.
The --exec option for git archive and the --upload-pack option for ls-remote both instruct Git to invoke an external command. Passing a value such as upload-pack=/tmp/malicious.sh causes Git to execute the referenced binary during the remote operation.
A secondary defect affects Repo.iter_commits() and Repo.blame(). These methods do not reject revision strings that begin with a leading dash. An argument such as --output=/etc/passwd is interpreted by Git as an output redirection flag, causing Git to open and truncate the specified file. This vulnerability is categorized under CWE-77 (Improper Neutralization of Special Elements used in a Command).
Root Cause
GitPython constructs Git invocations by mapping Python keyword arguments to CLI flags without an allowlist and without enforcing the -- separator before positional revision arguments. Git treats leading-dash tokens as options regardless of position, so any unfiltered value can be reinterpreted as a flag.
Attack Vector
An attacker submits a crafted string to an application endpoint that forwards the value to a vulnerable GitPython method. For command execution, the payload supplies a Git option that references an attacker-controlled binary reachable on the host. For file truncation, the payload supplies a revision beginning with a dash that Git parses as an output-writing option.
The vulnerability requires an application-level sink. GitPython itself does not expose a network service. See the GitHub Security Advisory GHSA-956x-8gvw-wg5v and the VulnCheck Advisory on GitPython for reference details.
Detection Methods for CVE-2026-67323
Indicators of Compromise
- Process telemetry showing git archive or git ls-remote invocations that include --exec= or --upload-pack= values pointing to writable or user-controlled paths.
- Git child processes spawning unexpected binaries such as shells, interpreters, or scripts from /tmp, /var/tmp, or application upload directories.
- Unexpected truncation or zero-byte modification of files owned by the account running the Python application.
- Application logs recording revision or remote parameters beginning with --.
Detection Strategies
- Perform software composition analysis (SCA) across Python environments to identify GitPython installations below 3.1.51.
- Instrument application code paths that call Repo.archive(), git.ls_remote(), Repo.iter_commits(), and Repo.blame() to log argument values.
- Deploy endpoint process monitoring to flag git child processes whose command lines contain --exec or --upload-pack outside of expected automation.
- Correlate web request parameters with subsequent git process launches to spot user input reaching Git flags.
Monitoring Recommendations
- Enable command-line auditing (auditdexecve, Sysmon Event ID 1) and alert on git executions containing --exec, --upload-pack, or --output=.
- Baseline the set of binaries invoked by the application service account and alert on deviations.
- Monitor file integrity on sensitive paths that the application user can reach to catch truncation attempts.
How to Mitigate CVE-2026-67323
Immediate Actions Required
- Upgrade GitPython to version 3.1.51 or later across all Python environments, containers, and CI/CD runners.
- Audit application source code for calls to Repo.archive(), git.ls_remote(), Repo.iter_commits(), and Repo.blame() that receive untrusted input.
- Reject any revision, remote, or option value that begins with a dash before passing it to GitPython.
- Restrict the service account running the application to the minimum filesystem permissions required.
Patch Information
GitPython 3.1.51 guards the affected methods against dangerous options and rejects leading-dash revision arguments. Refer to the GitHub Security Advisory GHSA-956x-8gvw-wg5v for patch commits and release notes.
Workarounds
- Validate all user-supplied strings against a strict allowlist before invoking GitPython methods.
- Enforce the -- separator manually when constructing revision lists, and strip any argument beginning with -.
- Run the application under a dedicated low-privilege user with no write access to sensitive system paths.
- Isolate Git operations inside a sandbox or container with noexec mounts on writable directories.
# Configuration example
pip install --upgrade 'GitPython>=3.1.51'
pip show GitPython | grep -i version
Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

