PT-2023-4751 · Gitpython+1 · Gitpython+1
Stsewd
·
Published
2023-08-28
·
Updated
2025-10-17
·
CVE-2023-40590
CVSS v4.0
8.6
High
| Vector | AV:N/AC:L/AT:N/PR:N/UI:A/VC:H/VI:H/VA:H/SC:N/SI:N/SA:N |
Name of the Vulnerable Software and Affected Versions
GitPython (affected versions not specified)
Description
The issue is related to how Python interacts with Windows systems, specifically when resolving a program. GitPython defaults to use the
git command, and if a user runs it from a repository with a git.exe or git executable, that program will be run instead of the one in the user's PATH. This allows an attacker to trick a user into downloading a repository with a malicious git executable, enabling the attacker to run arbitrary commands. The problem is more significant on Windows systems, as Linux and other OS are not affected.Recommendations
- Default to an absolute path for the git program on Windows, like
C:Program FilesGitcmdgit.EXE(default git path installation). - Require users to set the
GIT PYTHON GIT EXECUTABLEenvironment variable on Windows systems. - Make this problem prominent in the documentation and advise users to never run GitPython from an untrusted repository, or set the
GIT PYTHON GIT EXECUTABLEenv var to an absolute path. - Resolve the executable manually by only looking into the
PATHenvironment variable. At the moment, there is no information about a newer version that contains a fix for this vulnerability.
Exploit
Untrusted Search Path
Found an issue in the description? Have something to add? Feel free to write us 👾
Weakness Enumeration
Related Identifiers
Affected Products
Alt Linux
Gitpython