ZeroHour

CVE-2026-78677

PoC mass

GitPython clone APIs permit arbitrary .git directory placement via --separate-git-dir

CVSS 4.0
8.7 high
EPSS
<1%p36
Published
()
Modified
AI analysis

GitPython's clone-path safety check is incomplete: the denylist `Repo.unsafe_git_clone_options` used by `Repo.clone_from()` and `Repo.clone()` omits `--separate-git-dir`, even though GitPython's own documentation for these APIs states that `allow_unsafe_options=False` (the default) should block that option, and the sibling denylist for `Repo.init()` already blocks it for the same reason. Any application that forwards a caller-controlled `separate_git_dir`/`separate-git-dir` keyword argument into these clone APIs therefore bypasses the check entirely, causing `git clone` to redirect the repository's `.git` metadata directory to an arbitrary, attacker-chosen filesystem path while leaving only a gitlink text file at the intended destination. An attacker gains control over where git metadata (and the git directory itself) is written outside the target path — a path-control primitive that CVSS 4.0 scores as 8.7 High (network vector, no privileges or user interaction, High confidentiality impact, no integrity or availability impact). Affected users are pip-installation environments running GitPython (current release 3.1.58 at disclosure), particularly CI/build services, Git-hosting proxies, and tools that expose clone options to clients — the same threat model already accepted for the `--template`, `--upload-pack`, and `--config` entries in this list. There is no known exploitation: no public PoC, not in CISA KEV, and EPSS puts 30-day exploitation probability at about 0.4% (36th percentile); this is the latest in a series of roughly 16 published advisories since 2026-07-12 finding this same denylist mechanism incomplete.

What to do: Upgrade GitPython to a release newer than 3.1.58 once a fix is published, since remediation requires extending `unsafe_git_clone_options`; as an interim mitigation, audit any code that passes user- or caller-controlled keyword arguments to `Repo.clone_from()`/`Repo.clone()` and strip or reject `separate_git_dir`/`separate-git-dir` (and other clone options) from untrusted input. Note that setting `allow_unsafe_options=True` disables GitPython's option checks entirely, so if you use it, validate all forwarded clone options yourself.

Affected
GitPython (pip ecosystem) GitPythonthrough 3.1.58 (current release at disclosure, commit 9729ed3b948f2bde09f1f188c5311e172212b67e); no fixed release indicated in available data
Estimated exposure
masson the order of 1M+ Python environments carry GitPython (tens of millions of monthly PyPI downloads); the directly exploitable subset — apps forwarding… — Estimated from GitPython's status as a ubiquitous pip dependency embedded in widely deployed CI/build, security-scanning and Git-proxy tooling (mass installed base, all current versions unfixed), with exploitation limited to deployments…

Order-of-magnitude estimate by the model from install counts, market share and public scan data it knows; verify before quoting.

Description

GitPython before 3.1.59 omits --separate-git-dir from unsafe_git_clone_options, allowing attackers to create arbitrary git directories outside the intended clone destination. Attackers can pass a separate_git_dir parameter to Repo.clone_from() or Repo.clone() to redirect repository metadata to an attacker-controlled filesystem path, enabling arbitrary directory creation and potential hook execution.

Vendors
gitpython project
Products
gitpython
Ecosystems
pip
Weakness
CWE-22
Vector
CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:H/VI:N/VA:N/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-8mcc-hrx5-hvxc (high)

In the news

No ingested article mentions this CVE yet.