Skip to main content
Press slash or control plus K to focus the search. Use the arrow keys to navigate results and press enter to open a threat.
Reconnecting to live updates…

GitPython: command injection via unguarded Git options in `Repo.archive()`, `git.ls_remote()`, and arbitrary file overwrite via `Repo.iter_commits()` / `Repo.blame()`

0
High
Published: 07/21/2026 (07/21/2026, 20:10:06 UTC)
Source: GCVE Database
Product: GitPython

Description

GitPython versions prior to 3.1.51 contain multiple vulnerabilities due to insufficient validation of caller-supplied options in several public APIs. Specifically, `Repo.archive()` and `git.ls_remote()` allow arbitrary command execution by forwarding unsafe Git options without proper checks. Additionally, `Repo.iter_commits()` and `Repo.blame()` permit arbitrary file overwrite by placing unvalidated revision arguments before the end-of-options separator, enabling file truncation. These issues arise because the existing unsafe option checks are only applied to network commands and not extended to these other APIs.

CVSS v3.1

Score 8.4high

Attack Vector
Local
Attack Complexity
Low
Privileges Required
None
User Interaction
None
Scope
Unchanged
Confidentiality
High
Integrity
High
Availability
High
CVSS:3.1/AV:L/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H

Affected software

PyPIghsa
GitPython
Affected versions
<3.1.51

Run on your own infrastructure? Check whether these packages are installed with threat-finder — our free open-source scanner.

AI-Powered Analysis

Machine-generated threat intelligence

AILast updated: 07/22/2026, 00:54:11 UTC

Technical Analysis

GitPython spawns the Git binary with argument vectors constructed from caller inputs. To prevent command injection, it maintains a denylist of unsafe Git options enforced only on network commands (`clone_from`, `fetch`, `pull`, `push`). However, other APIs such as `Repo.archive()`, `git.ls_remote()`, `Repo.iter_commits()`, and `Repo.blame()` forward caller-controlled options or positional arguments directly to Git without invoking the unsafe option checks. This allows attackers to inject options like `--exec` or `--upload-pack` to execute arbitrary commands or use revision arguments starting with dashes to cause Git to open and truncate arbitrary files, leading to command execution and file overwrite vulnerabilities. The root cause is the incomplete application of `check_unsafe_options` and end-of-options discipline in these APIs.

Potential Impact

An attacker able to control inputs to `Repo.archive()` or `git.ls_remote()` can achieve arbitrary command execution on the host running GitPython. Inputs to `Repo.iter_commits()` or `Repo.blame()` can cause arbitrary file truncation or overwrite, potentially destroying critical files such as keys, configuration files, or lockfiles, impacting system integrity and availability. These vulnerabilities do not require elevated privileges or user interaction and can be exploited with local or remote input depending on usage context.

Mitigation Recommendations

Patch status is not yet confirmed — check the vendor advisory for current remediation guidance. Until an official fix is available, avoid passing untrusted or user-controlled inputs to `Repo.archive()`, `git.ls_remote()`, `Repo.iter_commits()`, and `Repo.blame()`. Restrict usage of these APIs to trusted inputs only. Monitor the GitPython project for updates that extend unsafe option checks to these APIs and apply patches promptly once released.

Pro Console: star threats, build custom feeds, automate alerts via Slack, email & webhooks.Upgrade to Pro

Technical Details

Gcve Source
db.gcve.eu
Osv Id
GHSA-956x-8gvw-wg5v
Osv Schema Version
1.4.0
Aliases
[]
Ecosystems
["PyPI"]
Database Specific Severity
HIGH
Cvss Version
3.1

Threat ID: 6a600abf9c2644c7f8fe3123

Added to database: 07/22/2026, 00:11:43 UTC

Last enriched: 07/22/2026, 00:54:11 UTC

Last updated: 07/31/2026, 12:28:12 UTC

Views: 20

Community Reviews

0 reviews

Crowdsource mitigation strategies, share intel context, and vote on the most helpful responses. Sign in to add your voice and help keep defenders ahead.

Sort by
Loading community insights…

Want to contribute mitigation steps or threat intel context? Sign in or create an account to join the community discussion.

Actions

PRO

Updates to AI analysis require Pro Console access. Upgrade inside Console → Billing.

Please log in to the Console to use AI analysis features.

Need more coverage?

Upgrade to Pro Console for AI refresh and higher limits.

For incident response and remediation, OffSeq services can help resolve threats faster.

Latest Threats

Breach by OffSeqOFFSEQFRIENDS — 25% OFF

Check if your credentials are on the dark web

Instant breach scanning across billions of leaked records. Free tier available.

Scan now
OffSeq TrainingCredly Certified

Lead Pen Test Professional

Technical5-day eLearningPECB Accredited
View courses