Skip to main content
CVE-2026-87817VulnerabilityPublished 09/09/2026Updated 10/08/2026

CVE-2026-87817: Improper Control of Generation of Code ('Code Injection') in gitpython-developers GitPython

Affects gitpython-developers GitPythonSource CVE Database V5

0
CVSS 4.0 base score
8.7High
How severe the flaw is on the 0–10 CVSS scale.
Exploitation

Not in CISA KEV, no exploitation reported

EPSS
0.4% chance of exploitation in 30 days – higher than 33% of CVEsExploit Prediction Scoring System: the likelihood attackers will use this flaw soon.
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

What to do

Affected software

ProductAffectedFixed in
gitpython-developersGitPythonAffected
  • <3.1.60
Fixed in
  • 3.1.60
PyPIgitpythonpkg:pypi/gitpythonOther threatsAffected
  • <3.1.60
Fixed in–

Check your own hosts for these packages with threat-finder (opens in a new tab), our free open-source scanner.

AI-suggested

Upgrade GitPython to version 3.1.60 or later, where this vulnerability is fixed. Patch status is confirmed by the versioning information indicating that versions before 3.1.60 are affected and the issue is resolved in 3.1.60. No vendor advisory content was provided, so check the official GitPython release notes or security advisories for confirmation.

Description

GitPython versions before 3.1.60 contain a code injection vulnerability due to improper validation of the git directory location. This flaw allows attackers to impersonate the git directory by manipulating tracked files such as gitdir, commondir, and HEAD. Exploitation can lead to arbitrary code execution when a victim calls index.commit() on a cloned or opened repository with a malicious pre-commit hook.

Impact

Successful exploitation allows an attacker to execute arbitrary code in the context of the user running GitPython. This can lead to compromise of the victim system or environment where the repository is used. The vulnerability does not require privileges or user interaction beyond invoking index.commit().

Summary

CVE-2026-87817 is a high-severity vulnerability in GitPython prior to version 3.1.60. The vulnerability arises from insufficient validation of the git directory location, enabling attackers to spoof the git directory using tracked files like gitdir, commondir, and HEAD. By placing a malicious pre-commit hook in the tracked hooks directory, an attacker can achieve arbitrary code execution triggered by the victim invoking index.commit() on the affected repository.

References

Community reviews

Loading reviews…

Get alerts for gitpython-developers GitPython by Slack, email or webhook with Pro Console, or bring in OffSeq incident response (opens in a new tab).

Threat ID
6aa1450bacd9273b494035f2
Added
09/09/2026, 11:37:47 UTC
Analysed
10/10/2026, 20:30:35 UTC
Updated
10/24/2026, 15:55:46 UTC
Views
97