# CVE-2026-87817: GitPython before 3.1.60 Remote Code Execution via Git Directory Impersonation

- Severity: High 8.7 (CVSS:4.0, scored by VulnCheck) `CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Likelihood of exploitation in the next 30 days (EPSS): 0.42%, higher than 38% of CVEs (2026-12-01)
- Public exploit code or proof of concept: one link below, marked "exploit"
- Published: 2026-09-09T11:21:04.007Z
- Modified: 2026-10-08T15:25:56.195Z
- Also known as: GHSA-239g-whfq-7xj9, PYSEC-2026-3982
- Weaknesses: CWE-94, CWE-427
- SSVC (CISA-ADP): exploitation none, automatable yes, technical impact total
- Assigned by: VulnCheck

## Description

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.

(As written by CVE List.)

## Affected

- gitpython-developers GitPython: before 3.1.60 (not affected: 3.1.60)
- gitpython (PyPI): before 3.1.60
- gitpython_project gitpython: before 3.1.60

## Every score

- VulnCheck: CVSS:4.0 8.7 High `CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N`
- VulnCheck: CVSS:3.1 8.8 High `CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H`
- GitHub: CVSS:3.1 8.8 High `CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H`
- PyPA Advisory Database: CVSS:4.0 `CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:P/VC:H/VI:H/VA:H/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`

## References

- <https://github.com/gitpython-developers/GitPython/security/advisories/GHSA-239g-whfq-7xj9> (exploit, evidence, mitigation, vendor-advisory, web)
- <https://www.vulncheck.com/advisories/gitpython-before-3.1.60-remote-code-execution-via-git-directory-impersonation> (advisory, third-party-advisory, web)
- <https://nvd.nist.gov/vuln/detail/CVE-2026-87817> (advisory)
- <https://github.com/gitpython-developers/GitPython/pull/2218> (web)
- <https://github.com/gitpython-developers/GitPython/commit/c7cf4d13b1ed0a2e70f2a1f3c6b4fc6c2652cf0b> (web)
- <https://github.com/gitpython-developers/GitPython> (package)
- <https://github.com/gitpython-developers/GitPython/releases/tag/3.1.60> (web)
- <https://github.com/pypa/advisory-database/tree/main/vulns/gitpython/PYSEC-2026-3982.yaml> (web)

## Sources

- CVE List: [CVE-2026-87817](https://www.cve.org/CVERecord?id=CVE-2026-87817), CVE Terms of Use, modified 2026-10-08
- GitHub Advisory Database: [GHSA-239g-whfq-7xj9](https://github.com/advisories/GHSA-239g-whfq-7xj9), CC-BY-4.0, modified 2026-09-30
- NVD: [CVE-2026-87817](https://nvd.nist.gov/vuln/detail/CVE-2026-87817), Public domain, modified 2026-09-16
- PyPA Advisory Database: [PYSEC-2026-3982](https://osv.dev/vulnerability/PYSEC-2026-3982), CC-BY-4.0, modified 2026-09-17

---

Page: https://cve.day/CVE-2026-87817 · Whole record: https://cve.day/CVE-2026-87817.json · Rebuilt by cve.day 2026-11-25T22:59:37.734Z
