GitPython: git-config OPTION-name injection via =/#/whitespace bypasses name validator, enabling forged core.sshCommand/hooksPath (RCE)
Affects GitPythonSource GCVE Database
CVSS 8.8 High : upgrade to 3.1.58 soon.
Data as of 8 Aug 2026, 15:41 UTC
- Patch
- Available – fixed in 3.1.58
CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:HWhat to do
Upgrade GitPython to 3.1.58.
Affected software
| Product | Affected | Fixed in |
|---|---|---|
| PyPIGitPython | Affected
| Fixed in
|
Check your own hosts for these packages with threat-finder (opens in a new tab), our free open-source scanner.
AI-suggested
A fix is available in GitPython 3.1.58 that applies the section-name safety checks to option names, rejecting unsafe characters such as '=', '#', ';', '[', ']', and whitespace. Users should upgrade to version 3.1.58 or later. Until upgraded, avoid passing untrusted input as option names to the config writer. Patch status is confirmed as fixed in 3.1.58.
Description
GitPython versions up to 3.1.57 contain a vulnerability in the config option name validation that allows injection of arbitrary git configuration directives. This occurs because the validator does not reject characters such as '=', '#', or whitespace in option names, enabling attackers to forge directives like core.sshCommand or core.hooksPath. Exploitation can lead to remote code execution on subsequent git operations. A patch is available to address this issue.
References
- github.com/gitpython-developers/GitPython/security/advisories/GHSA-jm78-9fvv-mhgr (opens in a new tab)
- github.com/gitpython-developers/GitPython/pull/2204 (opens in a new tab)
- github.com/gitpython-developers/GitPython/commit/a495ccd3b547ccd60b2187215823b72a9c0188bf (opens in a new tab)
- github.com/gitpython-developers/GitPython (opens in a new tab)
- github.com/gitpython-developers/GitPython/releases/tag/3.1.58 (opens in a new tab)