Gitpython · Gitpython · CVE-2023-40590
**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**
1. Default to an absolute path for the git program on Windows, like `C:Program FilesGitcmdgit.EXE` (default git path installation).
2. Require users to set the `GIT PYTHON GIT EXECUTABLE` environment variable on Windows systems.
3. Make this problem prominent in the documentation and advise users to never run GitPython from an untrusted repository, or set the `GIT PYTHON GIT EXECUTABLE` env var to an absolute path.
4. Resolve the executable manually by only looking into the `PATH` environment variable.
At the moment, there is no information about a newer version that contains a fix for this vulnerability.