Bug 1214734 (CVE-2023-40590) - VUL-0: CVE-2023-40590: python-GitPython: Untrusted search path on Windows systems leading to arbitrary code execution
Summary: VUL-0: CVE-2023-40590: python-GitPython: Untrusted search path on Windows sys...
Status: RESOLVED INVALID
Alias: CVE-2023-40590
Product: SUSE Security Incidents
Classification: Novell Products
Component: Incidents (show other bugs)
Version: unspecified
Hardware: Other Other
: P5 - None : Major
Target Milestone: ---
Assignee: Simon Lees
QA Contact: Security Team bot
URL: https://smash.suse.de/issue/376551/
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-08-29 07:40 UTC by Cathy Hu
Modified: 2023-08-29 07:41 UTC (History)
1 user (show)

See Also:
Found By: Security Response Team
Services Priority:
Business Priority:
Blocker: ---
Marketing QA Status: ---
IT Deployment: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Cathy Hu 2023-08-29 07:40:19 UTC
CVE-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
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.

References:
http://web.nvd.nist.gov/view/vuln/detail?vulnId=CVE-2023-40590
https://www.cve.org/CVERecord?id=CVE-2023-40590
https://docs.python.org/3/library/subprocess.html#popen-constructor
https://github.com/gitpython-developers/GitPython/security/advisories/GHSA-wfm5-v35h-vwf4
Comment 1 Cathy Hu 2023-08-29 07:41:25 UTC
Does not affect us, since this is only affected on windows.

Tracking as not affected:
- SUSE:ALP:Source:Standard:1.0/python-GitPython                   3.1.32
- SUSE:SLE-12-SP3:Update:Products:Cloud8:Update/python-GitPython  2.1.8                     
- SUSE:SLE-12-SP4:Update:Products:Cloud9:Update/python-GitPython  2.1.11                    
- openSUSE:Backports:SLE-15-SP4/python-GitPython                  3.1.12
- openSUSE:Factory/python-GitPython                               3.1.32

Closing