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

Published Sep 9, 2026
·
Updated

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 Software

1 affected component
GitPython GitPython<3.1.60

Event History

Sep 9, 2026
CVE Published
via MITRE·11:21 AM
Data Sourced
via MITRE·11:21 AM
DescriptionSeverityWeakness

Frequently Asked Questions

1

Who is exposed to exploitation?

Applications using GitPython versions before 3.1.60 are exposed when they clone or open a repository whose tracked files can be attacker-controlled, and then call index.commit() on that repository.

2

What must an attacker provide for code execution to occur?

The attacker needs to place files such as gitdir, commondir, or HEAD that impersonate the Git directory and provide a malicious pre-commit hook in the tracked hooks directory. The hook executes when the victim invokes index.commit().

3

Does exploitation require user interaction or authentication?

The supplied severity vector indicates network attack access, low complexity, no privileges required, and user interaction required. The described triggering action is the victim calling index.commit() on the cloned or opened repository.

4

What version resolves the issue?

GitPython 3.1.60 resolves the issue; versions before 3.1.60 are affected.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203