Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Snyk: High] Gitpython Untrusted Search Path(Due 02/28/2024) #6082

Closed
1 task
Tracked by #137
pkfec opened this issue Jan 17, 2024 · 0 comments · Fixed by #6100
Closed
1 task
Tracked by #137

[Snyk: High] Gitpython Untrusted Search Path(Due 02/28/2024) #6082

pkfec opened this issue Jan 17, 2024 · 0 comments · Fixed by #6100
Assignees
Labels
Security: high Remediate within 30 days
Milestone

Comments

@pkfec
Copy link
Contributor

pkfec commented Jan 17, 2024

Overview

GitPython is a python library used to interact with Git repositories

Affected versions of this package are vulnerable to Untrusted Search Path via the use of an untrusted search path on Windows. An attacker can execute arbitrary code by placing a malicious git.exe or bash.exe in the current directory, which may then be executed instead of the legitimate binaries when certain GitPython features are used.

Notes:

This is a completion of the fix for CVE-2023-40590.

When GitPython runs git directly rather than through a shell, the GitPython process performs the path search, and omits the current directory by setting NoDefaultCurrentDirectoryInExePath in its own environment during the Popen call.

GitPython sets the subprocess CWD to the root of a repository's working tree. Using a shell will run a malicious git.exe in an untrusted repository even if GitPython itself is run from a trusted location. This also applies if git.execute is called directly with shell=True or after git.USE_SHELL = True, to run any command.

On Windows, GitPython uses bash.exe to run hooks that appear to be scripts. However, unlike when running git, no steps are taken to avoid finding and running bash.exe in the current directory. While bash.exe is a shell, this is a separate scenario from when git is run using the unrelated Windows cmd.exe shell.

https://app.snyk.io/vuln/SNYK-PYTHON-GITPYTHON-6150683

Introduced through:

project@0.0.0 › gitpython@3.1.35

Remediation:

Upgrade gitpython to version 3.1.41

Completion criteria:

  • Upgraded gitpython to version 3.1.41 and snyk no longer flags the vulnerability
@pkfec pkfec added the Security: high Remediate within 30 days label Jan 17, 2024
@pkfec pkfec added this to the Sprint 24.1 milestone Jan 17, 2024
@pkfec pkfec changed the title [Snyk: High] Gitpython (Due 02/28/2024) [Snyk: High] Gitpython Untrusted Search Path(Due 02/28/2024) Jan 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Security: high Remediate within 30 days
Projects
Status: ✅ Done
Development

Successfully merging a pull request may close this issue.

2 participants