---
schema_version: '1.0'
id: security-20260917-ae26e4
title: CVE-2026-87817 — gitpython
url: https://osv.dev/vulnerability/PYSEC-2026-3982
url_hash: ae26e411e011a5278a8b612fe88ea883fc8b7d7ce6e792d01e2187ee7bfc468d
canonical_url: https://osv.dev/vulnerability/PYSEC-2026-3982
source: osv:pypa
category: security/library
category_raw: cve/library
region: null
tags:
- cve
- CVE-2026-87817
- PYSEC-2026-3982
- severity: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
- gitpython
- PyPI
lang: en
published_at: '2026-09-09T12:17:16Z'
fetched_at: '2026-09-17T16:07:54.008794Z'
updated_at: '2026-09-17T16:15:28Z'
status: published
content_hash: 43c547e39ba7fb2b0b58f61cec9c3dd44ebeccf7b5e411080a99633b25a266ea
content_changed_at: null
license_note: full
summary: 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 hook
summary_source: rss
summary_en: 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 hook
summary_omitted_reason: null
redistribution: true
keywords_en:
- cve
- CVE-2025-69230
- CVE-2026-87817
- gitpython
- library vulnerability
- PyPI
- PyPI:click
- PYSEC-2026-3982
- software security
entities_en:
- name: CVE-2025-69230
  type: event
- name: PyPI:click
  type: artifact
topics_en:
- library vulnerability
- software security
numeric_facts: []
entities:
- name: CVE-2025-69230
  type: event
- name: PyPI:click
  type: artifact
key_facts: []
related: []
related_auto:
- name: CVE-2026-40347
  type: event
  weight: 1.0
- name: CVE-2026-21441
  type: event
  weight: 1.0
- name: portal
  type: organization
  weight: 1.0
computed_at: '2026-09-17T16:15:23Z'
---

# CVE-2026-87817 — gitpython

## TL;DR
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 hook

## Key Points
- cve / CVE-2026-87817 / PYSEC-2026-3982 / severity: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 / gitpython / PyPI

## Details
**Severity:** 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
**Advisory:** PYSEC-2026-3982 (CVE-2026-87817)

**Details:**
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.

**References:**
- https://www.vulncheck.com/advisories/gitpython-before-3.1.60-remote-code-execution-via-git-directory-impersonation
- https://github.com/gitpython-developers/GitPython/security/advisories/GHSA-239g-whfq-7xj9

_Data: OSV.dev (upstream: pypa) — https://osv.dev/vulnerability/PYSEC-2026-3982_

## Source
元記事: [CVE-2026-87817 — gitpython](https://osv.dev/vulnerability/PYSEC-2026-3982) — published 2026-09-09T12:17:16Z
