CVE-2026-78677 Overview
CVE-2026-78677 is a path traversal vulnerability [CWE-22] in GitPython, a Python library that provides an object-oriented interface to Git repositories. Versions before 3.1.59 omit the --separate-git-dir option from the unsafe_git_clone_options allowlist. Attackers can pass a separate_git_dir parameter to Repo.clone_from() or Repo.clone() to redirect Git metadata to an attacker-controlled filesystem path. This enables arbitrary directory creation outside the intended clone destination and can lead to Git hook execution.
Critical Impact
Attackers who control clone parameters can create arbitrary Git directories on the host filesystem and potentially achieve code execution through planted Git hooks.
Affected Products
- GitPython versions before 3.1.59
- Python applications and services that expose Repo.clone_from() or Repo.clone() to untrusted input
- CI/CD pipelines and automation tools using vulnerable GitPython releases
Discovery Timeline
- 2026-08-25 - CVE-2026-78677 published to NVD
- 2026-08-25 - Last updated in NVD database
Technical Details for CVE-2026-78677
Vulnerability Analysis
GitPython maintains an unsafe_git_clone_options list to block Git clone options that can be abused for local filesystem manipulation or command execution. The --separate-git-dir option was missing from this allowlist in versions before 3.1.59. Applications that forward user-supplied parameters into Repo.clone_from() or Repo.clone() therefore accept separate_git_dir without sanitization.
When Git clones a repository with --separate-git-dir, the target path becomes the .git directory for the working tree. Git creates the directory if it does not exist. An attacker can therefore control where repository metadata, including the hooks/ subdirectory, is written. If the attacker also controls repository contents, they can plant executable hook scripts at that location and trigger them during subsequent Git operations.
Root Cause
The root cause is an incomplete deny list. GitPython's option-filtering logic depends on a static list of dangerous Git flags, and --separate-git-dir was not enumerated. Downstream callers that trust the library's filtering assume unsafe options are rejected, so no additional validation is applied at the application layer.
Attack Vector
Exploitation requires an attacker to control the separate_git_dir argument passed to a vulnerable Repo.clone_from() or Repo.clone() call over the network attack surface of a hosting application. The attacker supplies an absolute filesystem path pointing at a sensitive location writable by the process. Git creates the directory and populates it with repository metadata, enabling arbitrary directory creation. Chained with attacker-controlled repository content, this can be used to write Git hooks that execute on later git invocations.
See the GitHub Security Advisory GHSA-8mcc-hrx5-hvxc and the VulnCheck advisory for further technical detail.
Detection Methods for CVE-2026-78677
Indicators of Compromise
- Unexpected .git directories or hooks/ subdirectories created outside application-managed clone roots.
- Process telemetry showing git clone invocations with a --separate-git-dir flag pointing to sensitive paths.
- Executable files appearing under hooks/ such as post-checkout, post-merge, or pre-commit on servers that do not author Git hooks.
Detection Strategies
- Perform software composition analysis (SCA) across Python environments to identify GitPython installations below 3.1.59.
- Audit application code for calls to Repo.clone_from() and Repo.clone() that forward user-controlled keyword arguments.
- Inspect web application logs for HTTP parameters named separate_git_dir or clone options containing --separate-git-dir.
Monitoring Recommendations
- Alert on child git processes launched by application service accounts with unusual --separate-git-dir arguments.
- Monitor filesystem events for creation of HEAD, config, or hooks/ files outside expected repository roots.
- Log and review all repository clone operations initiated by user-facing services for anomalous destination paths.
How to Mitigate CVE-2026-78677
Immediate Actions Required
- Upgrade GitPython to version 3.1.59 or later in all Python environments, containers, and CI/CD images.
- Enumerate applications that expose clone functionality and validate they no longer accept separate_git_dir from untrusted callers.
- Rotate credentials and inspect hosts where vulnerable GitPython versions processed untrusted clone requests.
Patch Information
GitPython 3.1.59 adds --separate-git-dir to the unsafe_git_clone_options list, causing the library to reject the option unless the caller explicitly opts in via allow_unsafe_options. Refer to the GitPython advisory GHSA-8mcc-hrx5-hvxc for release details.
Workarounds
- Explicitly filter or reject the separate_git_dir keyword argument in application wrappers around Repo.clone_from() and Repo.clone().
- Run services that perform Git clone operations under least-privilege accounts with restricted filesystem write scope.
- Execute untrusted clone operations inside ephemeral sandboxes or containers with read-only mounts for sensitive paths.
# Configuration example
pip install --upgrade 'GitPython>=3.1.59'
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.

