What’s Vulnerable › Vulnerabilities

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

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.

Affected products

How to fix

Upgrade to a fixed version: gitpython-developers GitPython 3.1.60. Check the vendor advisory for mitigations.

References

Get alerted when CVE-2026-87817 or the next vulnerability affects your stack