{"id":"CVE-2023-40590","published":"2023-08-28T17:24:09Z","modified":"2024-10-02T14:04:39Z","title":"Untrusted search path on Windows systems leading to arbitrary code execution","vendor":"gitpython-developers","product":"GitPython","tier":"tail","description":{"text":" 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.","provenance":"source","from":"CVE.org"},"cvss":{"score":7.8,"severity":"HIGH","version":"3.1","vector":"CVSS:3.1/AV:L/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H","provenance":"source","from":"CVE.org CNA"},"epss":{"score":0.0038,"percentile":0.23816,"provenance":"source"},"cwes":[{"id":"CWE-426","name":"Untrusted Search Path"}],"references":[{"url":"https://github.com/gitpython-developers/GitPython/security/advisories/GHSA-wfm5-v35h-vwf4","tags":["x_refsource_CONFIRM"]},{"url":"https://docs.python.org/3/library/subprocess.html#popen-constructor","tags":["x_refsource_MISC"]}],"priority":{"score":10.2,"factors":[{"name":"EPSS percentile","points":4.76},{"name":"CVSS severity","points":5.46}]},"vendorSlug":"gitpython-developers","affectedVersions":[{"vendor":"gitpython-developers","product":"GitPython","versions":["<= 3.1.32"]}],"ssvc":{"exploitation":"poc","automatable":"no","technicalImpact":"total","timestamp":"2024-10-02T14:04:30.245441Z","from":"CISA ADP","provenance":"source"},"affected":[{"ecosystem":"PyPI","package":"GitPython","vulnerableRanges":["<3.1.33"],"patched":["3.1.33"],"from":["GHSA-wfm5-v35h-vwf4","PYSEC-2023-161"],"provenance":"source"}],"summary":{"text":"The flaw is an untrusted search path in GitPython, a Python library for interacting with Git repositories, which on Windows causes it to run a git executable found in the current working directory instead of the one on the user's PATH. An attacker who can get a user to download a repository containing a malicious git executable and then run or import GitPython from that directory can execute arbitrary commands, requiring local access and user interaction.","provenance":"ai","model":"claude-haiku-5-5","generatedAt":"2026-11-20T21:35:07Z"},"euvd":{"id":"EUVD-2023-0086","exploited":false,"provenance":"source"},"lineage":{"familyId":"fam-gitpython-developers-gitpython-cve-2022-24439","children":[{"from":"CVE-2023-40590","to":"CVE-2024-22190","relation":"incomplete-fix","confidence":"high","kind":"lineage","evidence":[{"kind":"text","provenance":"source","relation":"incomplete-fix","quote":"There is an incomplete fix for CVE-2023-40590.","from":"CVE.org","in":"CVE-2024-22190"},{"kind":"same-code","provenance":"machine","files":["git/cmd.py"],"commits":["https://github.com/gitpython-developers/GitPython/commit/8b75434e2c8a082cdeb4971cc6f0ee2bafec45bc","https://github.com/gitpython-developers/GitPython/commit/ef3192cc414f2fd9978908454f6fd95243784c7f"],"basis":"shared function","functions":["execute"]}]}],"packageHistory":[{"cve":"CVE-2022-24439","published":"2022-12-12","fixed":"3.1.30","kev":false},{"cve":"CVE-2023-40267","published":"2023-08-11","fixed":"3.1.32","kev":false,"link":{"from":"CVE-2023-40267","to":"CVE-2023-40590","relation":"successor","confidence":"low","kind":"sequence","evidence":[{"kind":"version-step","provenance":"source","package":"PyPI:GitPython","fromFixed":"3.1.32","toFixed":"3.1.33","daysApart":17}]}},{"cve":"CVE-2023-40590","published":"2023-08-28","fixed":"3.1.33","kev":false},{"cve":"CVE-2023-41040","published":"2023-08-30","fixed":"3.1.37","kev":false,"link":{"from":"CVE-2023-40590","to":"CVE-2023-41040","relation":"successor","confidence":"low","kind":"sequence","evidence":[{"kind":"version-step","provenance":"source","package":"PyPI:GitPython","fromFixed":"3.1.33","toFixed":"3.1.37","daysApart":2}]}},{"cve":"CVE-2024-22190","published":"2024-01-11","fixed":"3.1.41","kev":false},{"cve":"CVE-2026-42215","published":"2026-05-07","fixed":"3.1.47","kev":false}],"package":"PyPI:GitPython"}}