CVE-2026-42215
Undergoing Analysis Undergoing Analysis - In Progress
GitPython Arbitrary Command Execution via Unsafe Kwargs

Publication date: 2026-05-07

Last updated on: 2026-05-08

Assigner: GitHub, Inc.

Description
GitPython is a python library used to interact with Git repositories. From version 3.1.30 to before version 3.1.47, GitPython blocks dangerous Git options such as --upload-pack and --receive-pack by default, but the equivalent Python kwargs upload_pack and receive_pack bypass that check. If an application passes attacker-controlled kwargs into Repo.clone_from(), Remote.fetch(), Remote.pull(), or Remote.push(), this leads to arbitrary command execution even when allow_unsafe_options is left at its default value of False. This issue has been patched in version 3.1.47.
CVSS Scores
EPSS Scores
Probability:
Percentile:
Meta Information
Published
2026-05-07
Last Modified
2026-05-08
Generated
2026-05-09
AI Q&A
2026-05-08
EPSS Evaluated
N/A
NVD
EUVD
Affected Vendors & Products
Showing 1 associated CPE
Vendor Product Version / Range
gitpython_developers gitpython From 3.1.30 (inc) to 3.1.47 (exc)
Helpful Resources
Exploitability
CWE
CWE Icon
KEV
KEV Icon
CWE ID Description
CWE-78 The product constructs all or part of an OS command using externally-influenced input from an upstream component, but it does not neutralize or incorrectly neutralizes special elements that could modify the intended OS command when it is sent to a downstream component.
Attack-Flow Graph
AI Powered Q&A
How does this vulnerability affect compliance with common standards and regulations (like GDPR, HIPAA)?:

This vulnerability allows arbitrary command execution through GitPython when attacker-controlled input is passed to certain functions, potentially leading to theft of credentials, unauthorized repository modifications, or full compromise of the host process.

Such unauthorized access and potential data breaches could negatively impact compliance with common standards and regulations like GDPR and HIPAA, which require protection of sensitive data and secure handling of credentials.

Exploitation of this vulnerability could result in exposure or alteration of protected data, thereby violating confidentiality, integrity, and availability requirements mandated by these regulations.


Can you explain this vulnerability to me?

CVE-2026-42215 is a command injection vulnerability in the GitPython library, which is used to interact with Git repositories in Python.

The vulnerability arises because GitPython blocks dangerous Git command-line options like --upload-pack and --receive-pack by default, but the equivalent Python keyword arguments (kwargs) upload_pack and receive_pack bypass these checks.

This happens because the validation occurs before the kwargs are converted into Git command-line flags, allowing attacker-controlled kwargs passed into functions like Repo.clone_from(), Remote.fetch(), Remote.pull(), or Remote.push() to lead to arbitrary command execution.

This issue affects versions from 3.1.30 up to but not including 3.1.47, where it has been patched.


How can this vulnerability impact me? :

Exploitation of this vulnerability can lead to arbitrary command execution on the host running GitPython.

This can result in theft of credentials, unauthorized modifications to Git repositories, or even full compromise of the host process.

Applications affected include web applications, CI/CD systems, and automation tools that pass untrusted input into GitPython functions.


How can this vulnerability be detected on my network or system? Can you suggest some commands?

Detection of this vulnerability involves identifying usage of vulnerable GitPython versions (3.1.30 to before 3.1.47) in your environment, especially in applications or automation tools that use Repo.clone_from(), Remote.fetch(), Remote.pull(), or Remote.push() with potentially attacker-controlled kwargs.

Since the vulnerability involves bypassing Git option checks via Python kwargs, monitoring for unusual or unexpected usage of these functions with upload_pack or receive_pack keyword arguments can help detect exploitation attempts.

You can check installed GitPython version with the following Python command:

  • python -c "import git; print(git.__version__)"

To detect suspicious usage or attempts to exploit, you may audit logs or add instrumentation to monitor calls to Repo.clone_from(), Remote.fetch(), Remote.pull(), or Remote.push() that include upload_pack or receive_pack kwargs.

Network detection might be difficult as the attack is local to the Python library usage, but monitoring for unexpected Git commands or subprocess executions spawned by applications using GitPython could help.


What immediate steps should I take to mitigate this vulnerability?

The primary mitigation step is to upgrade GitPython to version 3.1.47 or later, where this vulnerability has been patched.

If upgrading immediately is not possible, ensure that applications do not pass untrusted or attacker-controlled kwargs such as upload_pack or receive_pack into Repo.clone_from(), Remote.fetch(), Remote.pull(), or Remote.push() functions.

Review and harden any automation, CI/CD pipelines, or web applications that use GitPython to prevent injection of unsafe options via kwargs.

Consider adding input validation or sanitization on any user-controlled inputs that might be passed to GitPython functions.


Ask Our AI Assistant
Need more information? Ask your question to get an AI reply (Powered by our expertise)
0/70
EPSS Chart