Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessCraft repository with malicious gitdir/commondir redirect
-
DeliveryHost or deliver repository to victim
-
ExploitVictim clones/opens attacker repository
-
ExecutionVictim application calls index.commit()
-
PersistGitPython resolves hooks path to attacker-controlled directory
-
ImpactPre-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. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – 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
Affected Packages
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
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
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.
AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
Primary rating from Vendor (VulnCheck).
CVSS VectorVendor: VulnCheck
Lifecycle Timeline
2DescriptionCVE.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.
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
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.
Apply vendor patch.
Threat Intelligence Overview
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.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
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.
All versions of package gitpython are vulnerable to Remote Code Execution (RCE) due to improper user input validation, w
Arbitrary code execution in GitPython before 3.1.59 arises from unsafe re-serialization of multi-line, quoted git-config
Command injection in GitPython before 3.1.51 allows low-privileged attackers to bypass the `check_unsafe_options` blockl
Command injection in GitPython 3.1.30-3.1.46 allows remote authenticated attackers to execute arbitrary commands via und
Command injection and arbitrary file overwrite in GitPython before 3.1.51 expose applications that pass attacker-control
Arbitrary directory creation and potential hook-based code execution in GitPython affects all releases before 3.1.59. Th
Environment variable exfiltration in GitPython before 3.1.52 allows any attacker who controls a URL passed to `Repo.clon
GitPython before 3.1.59 discloses local file content through exception messages when parsing .gitmodules files that cont
GitPython is a python library used to interact with Git repositories. Rated high severity (CVSS 7.8), this vulnerability
Arbitrary file read in GitPython before 3.1.59 allows low-privileged remote attackers to exfiltrate sensitive files by s
Arbitrary file read in GitPython versions before 3.1.59 exposes sensitive filesystem content to low-privileged network a
GitPython is a python library used to interact with Git repositories. Rated medium severity (CVSS 6.5), this vulnerabili
Same weakness CWE-94 – Code Injection
View allVendor 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 |
| SUSE Linux Enterprise Server 15 SP4-LTSS | Fixed |
| SUSE Linux Enterprise Server 15 SP5-LTSS | Fixed |
| SUSE Linux Enterprise Server 15 SP6-LTSS | Fixed |
| SUSE Linux Enterprise Server for SAP Applications 15 SP4 | Fixed |
| SUSE Linux Enterprise Server for SAP Applications 15 SP5 | Fixed |
| SUSE Linux Enterprise Server for SAP Applications 15 SP6 | Fixed |
| SUSE Linux Enterprise High Performance Computing 15 SP4-ESPOS | Affected |
| SUSE Linux Enterprise High Performance Computing 15 SP4-LTSS | Affected |
| SUSE Linux Enterprise Server 15 SP4-LTSS | Affected |
| SUSE Linux Enterprise Server 15 SP4-LTSS | Affected |
| SUSE Linux Enterprise Server 15 SP6-LTSS | Affected |
| SUSE Linux Enterprise Server 15 SP6-LTSS | Affected |
| SUSE Linux Enterprise Server 16.0 | Affected |
| SUSE Linux Enterprise Server for SAP Applications 15 SP4 | Affected |
| SUSE Linux Enterprise Server for SAP Applications 15 SP6 | Affected |
| SUSE Linux Enterprise Server for SAP applications 16.0 | Affected |
| SUSE Linux Enterprise Desktop 15 SP7 | Affected |
| SUSE Linux Enterprise Module for Python 3 15 SP7 | Affected |
| SUSE Linux Enterprise Server 15 SP7 | Affected |
| SUSE Linux Enterprise Server 16.0 | Affected |
| SUSE Linux Enterprise Server 16.1 | Affected |
| SUSE Linux Enterprise Server for SAP Applications 15 SP7 | Affected |
| SUSE Linux Enterprise Server for SAP applications 16.0 | Affected |
| SUSE Linux Enterprise Server for SAP applications 16.1 | Affected |
| openSUSE Leap 16.0 | Affected |
| SUSE Linux Enterprise High Performance Computing 15 SP4-LTSS | Affected |
| SUSE Linux Enterprise High Performance Computing 15 SP5 | Affected |
| SUSE Linux Enterprise High Performance Computing 15 SP5-LTSS | Affected |
| SUSE Linux Enterprise Module for Python 3 15 SP4 | Affected |
| SUSE Linux Enterprise Module for Python 3 15 SP5 | Affected |
| SUSE Linux Enterprise Module for Python 3 15 SP6 | Affected |
| SUSE Linux Enterprise Server 15 SP4 | Affected |
| SUSE Linux Enterprise Server 15 SP4-LTSS | Affected |
| SUSE Linux Enterprise Server 15 SP5 | Affected |
| SUSE Linux Enterprise Server 15 SP5-LTSS | Affected |
| SUSE Linux Enterprise Server 15 SP6 | Affected |
| SUSE Linux Enterprise Server 15 SP6-LTSS | Affected |
| SUSE Linux Enterprise Server for SAP Applications 15 SP4 | Affected |
| SUSE Linux Enterprise Server for SAP Applications 15 SP5 | Affected |
| SUSE Linux Enterprise Server for SAP Applications 15 SP6 | Affected |
| SUSE Linux Enterprise Desktop 15 SP4 | Affected |
| SUSE Linux Enterprise Desktop 15 SP5 | Affected |
| SUSE Linux Enterprise Desktop 15 SP6 | Affected |
| SUSE Linux Enterprise High Performance Computing 15 SP4 | Affected |
| SUSE Linux Enterprise High Performance Computing 15 SP4-ESPOS | Affected |
| SUSE Linux Enterprise High Performance Computing 15 SP5-ESPOS | Affected |
| SUSE Manager Proxy 4.3 | Affected |
| SUSE Manager Retail Branch Server 4.3 | Affected |
| SUSE Manager Server 4.3 | Affected |
| openSUSE Leap 15.4 | Affected |
| openSUSE Leap 15.5 | Affected |
| openSUSE Leap 15.6 | Affected |
EUVD-2026-74843
GHSA-2pxq-5vcg-rq29
NVD
CVE.org
EPSS
Vulnrichment
VulDB
Exploit-DB