CVE-2023-40590
published 2023-08-28CVE-2023-40590: GitPython is a python library used to interact with Git repositories. When resolving a program, Python/Windows look for the current working directory, and…
PriorityP338high7.8CVSS 3.1
AVLACLPRNUIRSUCHIHAH
EPSS
0.46%
36.8th percentile
GitPython is a python library used to interact with Git repositories. When resolving a program, Python/Windows look for the current working directory, and after that the PATH environment. GitPython defaults to use the `git` command, if a user runs GitPython from a repo has a `git.exe` or `git` executable, that program will be run instead of the one in the user's `PATH`. This is more of a problem on how Python interacts with Windows systems, Linux and any other OS aren't affected by this. But probably people using GitPython usually run it from the CWD of a repo. An attacker can trick a user to download a repository with a malicious `git` executable, if the user runs/imports GitPython from that directory, it allows the attacker to run any arbitrary commands. There is no fix currently available for windows users, however there are a few mitigations. 1: Default to an absolute path for the git program on Windows, like `C:\\Program Files\\Git\\cmd\\git.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 repo, 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.
Affected
7 ranges
| Vendor | Product | Version range | Fixed in |
|---|---|---|---|
| debian | python-git | — | — |
| gitpython-developers | gitpython | < 3.1.41 | 3.1.41 |
| gitpython_project | gitpython | < 3.1.41 | 3.1.41 |
| gitpython_project | gitpython | <= 3.1.32 | — |
| gitpython_project | gitpython | >= 0 < 3.1.33 | 3.1.33 |
| gitpython_project | gitpython | >= 0 < ef3192cc414f2fd9978908454f6fd95243784c7f | ef3192cc414f2fd9978908454f6fd95243784c7f |
| gitpython_project | gitpython | >= 0 < 3.1.41 | 3.1.41 |
CVSS provenance
nvdv3.17.8HIGHCVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H
ghsa7.8HIGH
osv7.8HIGH
vendor_debian7.8LOW
vendor_redhat7.8HIGH
Stop checking back — get the weekly exploitation signal.
Every Monday: what got weaponized or added to CISA KEV in the last seven days — each CVE cross-linked to its PoC, Nuclei template, and detection rule. Free, one email a week, unsubscribe in one click.
Debian
CVE-2024-22190: python-git - GitPython is a python library used to interact with Git repositories. There is a...
vendor_debian·2024·CVSS 7.8
CVE-2024-22190 [HIGH] CVE-2024-22190: python-git - GitPython is a python library used to interact with Git repositories. There is a...
GitPython is a python library used to interact with Git repositories. There is an incomplete fix for CVE-2023-40590. On Windows, GitPython uses an untrusted search path if it uses a shell to run `git`, as well as when it runs `bash.exe` to interpret hooks. If either of those features are used on Windows, a malicious `git.exe` or `bash.exe` may be run from an untrusted repository. This issue has been patched in version 3.1.41.
Scope: local
bookworm: resolved
bullseye: resolved
forky: resolved
sid: resolved
trixie: resolved
Red Hat
gitpython: improper executable lookup on windows
vendor_redhat·2023-08-28·CVSS 7.8
CVE-2023-40590 [HIGH] CWE-426 gitpython: improper executable lookup on windows
gitpython: improper executable lookup on windows
GitPython is a python library used to interact with Git repositories. When resolving a program, Python/Windows look for the current working directory, and after that the PATH environment. GitPython defaults to use the `git` command, if a user runs GitPython from a repo has a `git.exe` or `git` executable, that program will be run instead of the one in the user's `PATH`. This is more of a problem on how Python interacts with Windows systems, Linux and any other OS aren't affected by this. But probably people using GitPython usually run it from the CWD of a repo. An attacker can trick a user to download a repository with a malicious `git` executable, if the user runs/imports GitPython from that directory, it allows the attacker to run any arb
Debian
CVE-2023-40590: python-git - GitPython is a python library used to interact with Git repositories. When resol...
vendor_debian·2023·CVSS 7.8
CVE-2023-40590 [HIGH] CVE-2023-40590: python-git - GitPython is a python library used to interact with Git repositories. When resol...
GitPython is a python library used to interact with Git repositories. When resolving a program, Python/Windows look for the current working directory, and after that the PATH environment. GitPython defaults to use the `git` command, if a user runs GitPython from a repo has a `git.exe` or `git` executable, that program will be run instead of the one in the user's `PATH`. This is more of a problem on how Python interacts with Windows systems, Linux and any other OS aren't affected by this. But probably people using GitPython usually run it from the CWD of a repo. An attacker can trick a user to download a repository with a malicious `git` executable, if the user runs/imports GitPython from that directory, it allows the attacker to run any arbitrary commands. There is no fix currently availab
OSV
CVE-2024-22190: GitPython is a python library used to interact with Git repositories
osv·2024-01-11·CVSS 7.8
CVE-2024-22190 [HIGH] CVE-2024-22190: GitPython is a python library used to interact with Git repositories
GitPython is a python library used to interact with Git repositories. There is an incomplete fix for CVE-2023-40590. On Windows, GitPython uses an untrusted search path if it uses a shell to run `git`, as well as when it runs `bash.exe` to interpret hooks. If either of those features are used on Windows, a malicious `git.exe` or `bash.exe` may be run from an untrusted repository. This issue has been patched in version 3.1.41.
GHSA
Untrusted search path under some conditions on Windows allows arbitrary code execution
ghsa·2024-01-10·CVSS 7.8
CVE-2024-22190 [HIGH] CWE-426 Untrusted search path under some conditions on Windows allows arbitrary code execution
Untrusted search path under some conditions on Windows allows arbitrary code execution
### Summary
This issue exists because of an incomplete fix for CVE-2023-40590. On Windows, GitPython uses an untrusted search path if it uses a shell to run `git`, as well as when it runs `bash.exe` to interpret hooks. If either of those features are used on Windows, a malicious `git.exe` or `bash.exe` may be run from an untrusted repository.
### Details
Although GitPython often avoids executing programs found in an untrusted search path since 3.1.33, two situations remain where this still occurs. Either can allow arbitrary code execution under some circumstances.
#### When a shell is used
GitPython can be told to run `git` commands through a shell rather than as direct subprocesses, by passing `sh
OSV
Untrusted search path under some conditions on Windows allows arbitrary code execution
osv·2024-01-10·CVSS 7.8
CVE-2024-22190 [HIGH] Untrusted search path under some conditions on Windows allows arbitrary code execution
Untrusted search path under some conditions on Windows allows arbitrary code execution
### Summary
This issue exists because of an incomplete fix for CVE-2023-40590. On Windows, GitPython uses an untrusted search path if it uses a shell to run `git`, as well as when it runs `bash.exe` to interpret hooks. If either of those features are used on Windows, a malicious `git.exe` or `bash.exe` may be run from an untrusted repository.
### Details
Although GitPython often avoids executing programs found in an untrusted search path since 3.1.33, two situations remain where this still occurs. Either can allow arbitrary code execution under some circumstances.
#### When a shell is used
GitPython can be told to run `git` commands through a shell rather than as direct subprocesses, by passing `sh
GHSA
GitPython untrusted search path on Windows systems leading to arbitrary code execution
ghsa·2023-08-29
CVE-2023-40590 [HIGH] CWE-426 GitPython untrusted search path on Windows systems leading to arbitrary code execution
GitPython untrusted search path on Windows systems leading to arbitrary code execution
### Summary
When resolving a program, Python/Windows look for the current working directory, and after that the PATH environment (see big warning in https://docs.python.org/3/library/subprocess.html#popen-constructor). GitPython defaults to use the `git` command, if a user runs GitPython from a repo has a `git.exe` or `git` executable, that program will be run instead of the one in the user's `PATH`.
### Details
This is more of a problem on how Python interacts with Windows systems, Linux and any other OS aren't affected by this. But probably people using GitPython usually run it from the CWD of a repo.
The execution of the `git` command happens in
https://github.com/gitpython-developers/GitPython/
OSV
GitPython untrusted search path on Windows systems leading to arbitrary code execution
osv·2023-08-29
CVE-2023-40590 [HIGH] GitPython untrusted search path on Windows systems leading to arbitrary code execution
GitPython untrusted search path on Windows systems leading to arbitrary code execution
### Summary
When resolving a program, Python/Windows look for the current working directory, and after that the PATH environment (see big warning in https://docs.python.org/3/library/subprocess.html#popen-constructor). GitPython defaults to use the `git` command, if a user runs GitPython from a repo has a `git.exe` or `git` executable, that program will be run instead of the one in the user's `PATH`.
### Details
This is more of a problem on how Python interacts with Windows systems, Linux and any other OS aren't affected by this. But probably people using GitPython usually run it from the CWD of a repo.
The execution of the `git` command happens in
https://github.com/gitpython-developers/GitPython/
OSV
CVE-2023-40590: GitPython is a python library used to interact with Git repositories
osv·2023-08-28
CVE-2023-40590 CVE-2023-40590: GitPython is a python library used to interact with Git repositories
GitPython is a python library used to interact with Git repositories. When resolving a program, Python/Windows look for the current working directory, and after that the PATH environment. GitPython defaults to use the `git` command, if a user runs GitPython from a repo has a `git.exe` or `git` executable, that program will be run instead of the one in the user's `PATH`. This is more of a problem on how Python interacts with Windows systems, Linux and any other OS aren't affected by this. But probably people using GitPython usually run it from the CWD of a repo. An attacker can trick a user to download a repository with a malicious `git` executable, if the user runs/imports GitPython from that directory, it allows the attacker to run any arbitrary commands. There is no fix currently availab
No detection rules found.
No public exploits indexed.
https://docs.python.org/3/library/subprocess.html#popen-constructorhttps://github.com/gitpython-developers/GitPython/security/advisories/GHSA-wfm5-v35h-vwf4https://docs.python.org/3/library/subprocess.html#popen-constructorhttps://github.com/gitpython-developers/GitPython/security/advisories/GHSA-wfm5-v35h-vwf4
2023-08-28
Published