OS Command Injection in GitPython - CVE-2026-42215

 

OS Command Injection in GitPython - CVE-2026-42215

Published: April 27, 2026 / Updated: May 11, 2026


Vulnerability identifier: #VU128120
CSH Severity: Medium
CVSS v4: 8.7 [CVSS:4.0/AV:N/AC:L/AT:N/PR:L/UI:N/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N]
CVE-ID: CVE-2026-42215
CWE-ID: CWE-78
Exploitation vector: Remote access
Exploit availability: No public exploit available

Vulnerability details

The vulnerability allows a remote user to execute arbitrary code.

The vulnerability exists due to command injection in Repo.clone_from(), Remote.fetch(), Remote.pull(), and Remote.push() when processing attacker-controlled kwargs that are normalized into unsafe Git options. A remote user can supply crafted upload_pack or receive_pack values to execute arbitrary code.

The issue occurs because underscore-form kwargs bypass the unsafe-option check before being converted into dangerous command-line flags, and it does not require a malicious repository.


Affected software

GitPython
Fedora
Ubuntu
openEuler
python-git (Ubuntu package)
python3-GitPython
python-GitPython-help
python-GitPython
GitPython

How to mitigate CVE-2026-42215

Install security update from vendor's website.

GitPython - update to 3.1.59
python-git (Ubuntu package) - addressed in versions 0.3.2~RC1-3ubuntu0.1~esm3, 1.0.1+git137-gc8b8379-2.1ubuntu0.1~esm4, 2.1.8-1ubuntu0.1~esm4, 3.0.7-1ubuntu0.1~esm4, 3.1.24-1ubuntu0.1~esm3, 3.1.37-3ubuntu0.1~esm2, 3.1.46-1ubuntu0.1~esm1
python3-GitPython - update to 3.1.49-1
python-GitPython-help - update to 3.1.49-1
python-GitPython - update to 3.1.49-1
GitPython - addressed in versions 3.1.50-1.el9, 3.1.50-1.el10_1, 3.1.50-1.el10_3, 3.1.50-1.fc42, 3.1.50-1.fc43, 3.1.50-1.fc44

External References

Related Security Bulletins