high8.8
CVE-2026-87817
GitPython before 3.1.60 fails to properly validate the git directory location, allowing attackers to impersonate the git directory using tracked files like git…
Impact
GitPython before 3.1.60 fails to properly validate the git directory location, allowing attackers to impersonate the git directory using tracked files like gitdir, commondir, and HEAD. Attackers can execute arbitrary code by placing a malicious pre-commit hook in the tracked hooks directory that executes when a victim calls index.commit() on a cloned or opened repository.
Affected packages
| Ecosystem | Package | Affected | Fixed in |
|---|---|---|---|
| pip | gitpython | <= 3.1.59 | 3.1.60 |
Affected products
| Vendor | Product | Affected versions |
|---|---|---|
| Gitpython Project | Gitpython | before 3.1.60 |
Weakness classification
References
- NVD record
- CVE.org record
- GitHub advisory
- https://github.com/advisories/GHSA-239g-whfq-7xj9
- https://github.com/gitpython-developers/GitPython/security/advisories/GHSA-239g-whfq-7xj9
- https://nvd.nist.gov/vuln/detail/CVE-2026-87817
- https://github.com/gitpython-developers/GitPython/pull/2218
- https://github.com/gitpython-developers/GitPython/commit/c7cf4d13b1ed0a2e70f2a1f3c6b4fc6c2652cf0b
- https://github.com/gitpython-developers/GitPython/releases/tag/3.1.60
- https://github.com/pypa/advisory-database/tree/main/vulns/gitpython/PYSEC-2026-3982.yaml
- https://www.vulncheck.com/advisories/gitpython-before-3.1.60-remote-code-execution-via-git-directory-impersonation