---
id: CVE-2026-87817
title: >-
  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
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
  ma…
severity: high
cvss: 8.8
cvssVector: 'CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H'
cwe:
  - CWE-94
  - CWE-22
vendor: gitpython_project
product: gitpython
affected:
  - gitpython < 3.1.60
patched:
  - gitpython 3.1.60
published: '2026-09-09'
updated: '2026-09-16'
sourceUpdated: '2026-09-16T15:24:41.533'
source: NVD
sourceUrl: 'https://nvd.nist.gov/vuln/detail/CVE-2026-87817'
references:
  - url: >-
      https://github.com/gitpython-developers/GitPython/security/advisories/GHSA-239g-whfq-7xj9
    label: disclosure@vulncheck.com
  - url: >-
      https://www.vulncheck.com/advisories/gitpython-before-3.1.60-remote-code-execution-via-git-directory-impersonation
    label: disclosure@vulncheck.com
  - url: >-
      https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-87817.json
  - url: 'https://access.redhat.com/security/cve/CVE-2026-87817'
  - url: 'https://bugzilla.redhat.com/show_bug.cgi?id=2530744'
  - url: 'https://www.cve.org/CVERecord?id=CVE-2026-87817'
  - url: 'https://nvd.nist.gov/vuln/detail/CVE-2026-87817'
  - url: 'https://access.redhat.com/errata/RHSA-2026:68764'
  - url: 'https://access.redhat.com/errata/RHSA-2026:68780'
  - url: 'https://access.redhat.com/errata/RHSA-2026:71114'
  - url: 'https://access.redhat.com/errata/RHSA-2026:71113'
  - url: 'https://access.redhat.com/errata/RHSA-2026:71210'
  - url: 'https://access.redhat.com/errata/RHSA-2026:71179'
  - url: 'https://access.redhat.com/errata/RHSA-2026:71177'
tags:
  - nvd
  - cve.org
  - csaf
  - vex
  - red-hat
  - osv
  - pip
epss: 0.00405
epssPercentile: 0.32005
ssvc:
  exploitation: none
  automatable: 'yes'
  technicalImpact: total
  timestamp: '2026-09-10T14:27:39.154180Z'
ingestedAt: '2026-09-09T12:08:31.842Z'
aliases:
  - PYSEC-2026-3982
  - GHSA-239g-whfq-7xj9
ecosystem: pip
---

## Overview

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

- `gitpython < 3.1.60`

## Remediation

Upgrade past the affected range:

- `gitpython 3.1.60`

## Vendor advisories

- **Red Hat VEX** · Important · affected: Exploit Intelligence, Red Hat AI Inference Server, Red Hat Ansible Automation Platform 2, Red Hat Enterprise Linux AI (RHEL AI) 3, Red Hat OpenShift AI (RHOAI), Red Hat OpenStack Platform 16.2, … · no fix planned: Exploit Intelligence, Red Hat AI Inference Server, Red Hat Ansible Automation Platform 2, Red Hat Enterprise Linux AI (RHEL AI) 3, … · updated 2026-09-24 · [vex](https://security.access.redhat.com/data/csaf/v2/vex/2026/cve-2026-87817.json)
- **RHSA-2026:68764** · Red Hat · fixed in: Red Hat Satellite 6.18 · released 2026-09-17 · [advisory](https://access.redhat.com/errata/RHSA-2026:68764)
- **RHSA-2026:68780** · Red Hat · fixed in: Red Hat Satellite 6.19 · released 2026-09-17 · [advisory](https://access.redhat.com/errata/RHSA-2026:68780)
- **RHSA-2026:71114** · Red Hat · fixed in: Red Hat Ansible Automation Platform 2.5 for RHEL 8, Red Hat Ansible Automation Platform 2.5 for RHEL 9 · released 2026-09-23 · [advisory](https://access.redhat.com/errata/RHSA-2026:71114)
- **RHSA-2026:71113** · Red Hat · fixed in: Red Hat Ansible Automation Platform 2.6 for RHEL 9 · released 2026-09-23 · [advisory](https://access.redhat.com/errata/RHSA-2026:71113)
- **RHSA-2026:71210** · Red Hat · fixed in: Red Hat Ansible Automation Platform 2.5 · released 2026-09-23 · [advisory](https://access.redhat.com/errata/RHSA-2026:71210)
- **RHSA-2026:71179** · Red Hat · fixed in: Red Hat Ansible Automation Platform 2.6 · released 2026-09-23 · [advisory](https://access.redhat.com/errata/RHSA-2026:71179)
- **RHSA-2026:71177** · Red Hat · fixed in: Red Hat Ansible Automation Platform 2.7 · released 2026-09-23 · [advisory](https://access.redhat.com/errata/RHSA-2026:71177)

## Package advisory (CVE-2026-87817)

Affected packages:

- `gitpython < 3.1.60`

Patched in:

- `gitpython 3.1.60`

Source: https://osv.dev/vulnerability/PYSEC-2026-3982
