Skip to main content

GitPython EUVDEUVD-2026-74843

| CVE-2026-87817 HIGH
Code Injection (CWE-94)
8.7
CVSS 4.0 · Vendor: VulnCheck
View

Attack ChainAIDerived

Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain

  1. Access
    Craft repository with malicious gitdir/commondir redirect
  2. Delivery
    Host or deliver repository to victim
  3. Exploit
    Victim clones/opens attacker repository
  4. Execution
    Victim application calls index.commit()
  5. Persist
    GitPython resolves hooks path to attacker-controlled directory
  6. Impact
    Pre-commit hook executes arbitrary shell commands

Vulnerability Assessment

Weakness
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V1 - Encoding and Sanitization Code injection prevention, sandbox exec
MITRE ATT&CK

2 techniques across 2 tactics: Execution, Initial Access

The technique list with ATT&CK links and the kill-chain view is part of the Basic plan and up.

Exploitation Conditions

Exploitation requires three specific conditions to be met simultaneously. First, a victim application must use GitPython's index.commit() API (or any other GitPython code path that triggers Git hook execution) after opening or cloning a repository. Second, the repository must originate from or have been modified by the attacker - either because the victim cloned an attacker-controlled repo, or because an attacker was able to introduce malicious tracked files (gitdir, commondir, HEAD) into an existing repository. Third, the victim process must have write access to the filesystem path that the malicious gitdir/commondir redirect resolves to, so the pre-commit hook file can reside there. Exploitation is limited to: applications that call index.commit() on untrusted repositories; Python environments running GitPython < 3.1.60; and platforms where the hook script can execute (i.e., not read-only or no-exec mounted filesystems). No authentication to the victim system is required by the attacker, but passive user interaction (UI:P) - specifically, the action of performing a commit operation - is necessary.

Impact

The CVSS 4.0 vector (AV:N/AC:L/AT:N/PR:N/UI:P, score 8.7) reflects a realistic threat model: the attacker hosts a malicious repository publicly or delivers it through a supply chain vector, and exploitation requires only that the victim application call index.commit() after cloning or opening it - a common and expected operation. The UI:P (passive user interaction) rating is the primary limiting factor; exploitation cannot occur without a victim application actually processing the attacker-supplied repository. No KEV listing is present and no public exploit code has been identified, so real-world exploitation pressure is currently low. However, the EPSS signal is absent from the provided data. The attack is fully automatable once a victim is exposed to a malicious repository, meaning CI/CD systems that automatically clone and commit to external or contributor-submitted repositories are at elevated risk. The technical impact is full code execution under the process's privileges - equivalent to a supply-chain hook injection. Overall priority should be high for any Python application that uses GitPython to process untrusted or third-party repositories.

Exploit ScenarioDerived

An attacker publishes an open-source Python project or submits a pull request to a target repository; the project's repository contains crafted gitdir and commondir tracked files that redirect GitPython's git-directory resolution to a hooks/ subdirectory within the working tree. When the victim's CI/CD pipeline or developer tool clones the repository and calls index.commit() to create a commit (e.g., for changelog generation, version bumping, or automated PR workflows), GitPython triggers the attacker-planted pre-commit hook, executing arbitrary shell commands under the CI runner's or developer's account. No memory corruption or binary exploitation is involved - the attack is entirely filesystem and configuration-level.

This Week Schedule remediation this week. Why: HIGH severity (CVSS 7.0-8.9).
Patch available 0.3% exploitation probability (EPSS)

Get an e-mail when this CVE is exploited, patched or re-scored. Free account.

Alert me

AnalysisAIv1 – Sep 09, 2026

Arbitrary code execution in GitPython before 3.1.60 is possible when a victim application calls index.commit() on an attacker-controlled repository. The root cause is insufficient validation of the git directory location: GitPython trusts tracked files such as gitdir, commondir, and HEAD to resolve the effective git directory, allowing a crafted repository to redirect that resolution to an attacker-controlled path containing a malicious pre-commit hook. No public exploit has been identified at time of analysis, but the attack is realistic in any Python-based DevOps pipeline, CI/CD system, or tooling that opens and commits to externally sourced repositories.

RemediationAI

Upgrade GitPython to version 3.1.60 or later, which contains the vendor-released fix per the upstream advisory at https://github.com/gitpython-developers/GitPython/security/advisories/GHSA-239g-whfq-7xj9. In Python environments, run 'pip install --upgrade gitpython>=3.1.60' or pin the version in requirements.txt/pyproject.toml. If an immediate upgrade is not possible, the primary compensating control is to restrict index.commit() calls to repositories cloned from fully trusted, verified sources only - do not allow untrusted user-supplied repository paths or URLs to be processed by GitPython. Additionally, running GitPython-based workloads in sandboxed environments (containers with no-execute mounts, dropped capabilities, or read-only filesystems outside the working directory) limits the blast radius of hook execution. Disabling Git hooks at the OS level (e.g., setting the hooks path to an empty or non-executable directory via git config core.hooksPath /dev/null before committing) is a surgical workaround but may break legitimate hook-dependent workflows.

Affected VersionsENISA

GitPython 0 <3.1.60

Affected Packages

pypi gitpython fix: 3.1.60

Source: OSV (Open Source Vulnerabilities)

Affects your stack

Affects 1 package in pypi

Checking this CVE against your own stacks and servers is part of the Basic plan and up.

Technical ContextAI · show details

GitPython (cpe:2.3:a:gitpython-developers:gitpython:*:*:*:*:*:*:*:*) is a widely used Python library for programmatically interacting with Git repositories. Git supports worktree indirection through special files - notably .git/gitdir, .git/commondir, and HEAD - which can redirect the effective git directory to a different on-disk location. GitPython failed to enforce that these redirect targets remain within a trusted boundary (e.g., within the originally opened repository path). This falls under CWE-94 (Improper Control of Generation of Code): by controlling where GitPython believes the git directory is, an attacker can plant a hooks/pre-commit script at the resolved path. Git hooks execute as shell scripts with the user's privileges when Git operations such as commit are triggered. The vulnerability affects all GitPython releases before 3.1.60 and is triggered solely through normal library API usage (index.commit()), requiring no exploitation of memory-safety primitives.

Know when Gitpython gets its next vulnerability

  • Watch products and get an email when something new is published
  • Check this CVE against your own stack and servers
  • Exploit and PoC references, threat intelligence from 22 sources

No credit card · 7-day full trial

Severity by source

Vendor (VulnCheck) PRIMARY 8.7 HIGH
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
vuln.today AI 8.8 HIGH

Network-hosted malicious repo, no attacker privileges needed, but victim must actively call index.commit() (UI:R); full code execution gives C:H/I:H/A:H.

3.1 AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
4.0 AV:N/AC:L/AT:N/PR:N/UI:P/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N
SUSE 8.8 HIGH
AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
Red Hat 8.8 HIGH

Primary rating from Vendor (VulnCheck).

CVSS VectorVendor: VulnCheck

Attack Vector
Network
Attack Complexity
Low
Attack Requirements
None
Privileges Required
None
User Interaction
Passive
Vulnerable system: Confidentiality
High
Vulnerable system: Integrity
High
Vulnerable system: Availability
High
Subsequent system: Confidentiality
None
Subsequent system: Integrity
None
Subsequent system: Availability
None

Lifecycle Timeline

2
Patch available
Sep 09, 2026 - 12:03 EUVD
CVE Published
Sep 09, 2026 - 11:21 cve.org
HIGH 8.7

DescriptionCVE.org

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.

Blast Radius

ecosystem impact
† from your stack dependencies † transitive graph · vuln.today resolves 4-path depth
  • 1 pypi packages depend on gitpython (1 direct, 0 indirect)

Ecosystem-wide dependent count for version 3.1.60.

Technical POC Analysis

The flaw is in GitPython's repository autodetection: Repo.init decides which directory is the git directory by testing candidate paths in an order that considers the real .git last.

Full technical POC analysis - root cause, step-by-step exploitation and patch breakdown - is part of the Pro and Business plans.

Executive ViewAI

Why It Matters

GitPython versions before 3.1.60 contain a critical code execution vulnerability affecting CI/CD and deployment automation systems. Organizations that integrate external repositories through GitPython-based tooling face direct risk of pipeline compromise and unauthorized code injection into production environments.

Business Impact: High
Compensating Controls

Apply vendor patch.

Threat Intelligence Overview

EPSS Score
0.3%
Top 76% exploitable
Prevalence
High
popular Python library used widely in DevOps and CI/CD tooling
Threat Intel
1
1 sources
Data Quality
7 sources
Confidence: High
EUVD 🇯🇵JVN NVD CVE.org EPSS Vulnrichment GHSA Vendor GitHub VulDB

How this decision was reached

The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.

SignalValue
Severity HIGH
CISA KEV No
Public POC No
EPSS 0.3%
Patch available Yes
Active threat No
Deciding rule
HIGH severity (CVSS 7.0-8.9)
What every action level means
Emergency Immediate action required. Criteria: CRITICAL + in CISA KEV (actively exploited) without patch, OR CRITICAL + EPSS > 30% without patch, OR CRITICAL + active threat signals without patch.
Act Now Prioritize within 24-48h. Criteria: in KEV with patch available, OR CRITICAL + public POC, OR HIGH + EPSS > 10%, OR CRITICAL + active threat, OR any CRITICAL severity.
This Week Schedule remediation this week. Criteria: HIGH severity (CVSS 7.0-8.9). Patch within normal change window.
This Month Plan within 30 days. Criteria: MEDIUM severity (CVSS 4.0-6.9), lower exploitation probability. Include in regular patch cycle.
Monitor Track and reassess. Criteria: LOW severity (CVSS 0.1-3.9), minimal exploitation risk. No immediate action needed.

SSVC AssessmentENISA

SSVC Decision
Scheduled
Exploitation
None
System Exposure· derived
Open
Automatable
Yes
Human Impact
High
Technical Impact
Total

Priority Score

44
Low Medium High Critical
KEV: 0
EPSS: 0
CVSS: +44
PoC: 0
Weaponized: 0
Threat intel: 0
Gov advisory: 0

Attack Technique

Code Injection CRITICAL

Code injection occurs when an application accepts user input and passes it directly into a language interpreter or evaluator without proper sanitization.

Remote Code Execution represents the critical moment when an attacker successfully runs arbitrary code on a target system without physical access.

CVE-2022-24439 CRITICAL POC
9.8 Dec 06

All versions of package gitpython are vulnerable to Remote Code Execution (RCE) due to improper user input validation, w

CVE-2026-78676 CRITICAL POC
9.3 Aug 25

Arbitrary code execution in GitPython before 3.1.59 arises from unsafe re-serialization of multi-line, quoted git-config

CVE-2026-67325 HIGH POC
8.7 Aug 01

Command injection in GitPython before 3.1.51 allows low-privileged attackers to bypass the `check_unsafe_options` blockl

CVE-2026-42215 HIGH POC
8.8 May 07

Command injection in GitPython 3.1.30-3.1.46 allows remote authenticated attackers to execute arbitrary commands via und

CVE-2026-67323 HIGH POC
8.6 Aug 01

Command injection and arbitrary file overwrite in GitPython before 3.1.51 expose applications that pass attacker-control

CVE-2026-78677 HIGH POC
8.7 Aug 25

Arbitrary directory creation and potential hook-based code execution in GitPython affects all releases before 3.1.59. Th

CVE-2026-67322 HIGH POC
8.7 Aug 01

Environment variable exfiltration in GitPython before 3.1.52 allows any attacker who controls a URL passed to `Repo.clon

CVE-2026-78675 HIGH POC
8.6 Aug 25

GitPython before 3.1.59 discloses local file content through exception messages when parsing .gitmodules files that cont

CVE-2023-40590 HIGH POC
7.8 Aug 28

GitPython is a python library used to interact with Git repositories. Rated high severity (CVSS 7.8), this vulnerability

CVE-2026-78679 HIGH POC
7.1 Aug 25

Arbitrary file read in GitPython before 3.1.59 allows low-privileged remote attackers to exfiltrate sensitive files by s

CVE-2026-78678 HIGH POC
7.1 Aug 25

Arbitrary file read in GitPython versions before 3.1.59 exposes sensitive filesystem content to low-privileged network a

CVE-2023-41040 MEDIUM POC
6.5 Aug 30

GitPython is a python library used to interact with Git repositories. Rated medium severity (CVSS 6.5), this vulnerabili

Vendor StatusVendor

SUSE

Severity: Important
Product Status
SUSE Linux Enterprise Desktop 15 SP7 SUSE Linux Enterprise Module for Python 3 15 SP7 SUSE Linux Enterprise Server 15 SP7 SUSE Linux Enterprise Server for SAP Applications 15 SP7 Fixed
SUSE Linux Enterprise High Performance Computing 15 SP4-ESPOS Fixed
SUSE Linux Enterprise High Performance Computing 15 SP4-LTSS Fixed
SUSE Linux Enterprise High Performance Computing 15 SP5-ESPOS Fixed
SUSE Linux Enterprise High Performance Computing 15 SP5-LTSS Fixed

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy