# CVE-2024-22190: GitPython untrusted search path code execution on Windows

Source: https://junglewise.ai/threats/cve-2024-22190-gitpython-untrusted-search-path-code-execution-on-windows  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2024-01-11. Updated: 2026-09-26  
License: CC BY 4.0 with a link back

CVE-2024-22190 · Severity: low · CVSS 3.1 · Published 2024-01-11

GitPython is a widely-used library that applications use to interact with Git repositories. On Windows, GitPython can be tricked into running malicious executables (git.exe or bash.exe) from an untrusted repository if shell execution is enabled or if git hooks are present. An attacker controlling a repository branch or fork could achieve arbitrary code execution on systems using affected versions.

Technologies: [gitpython (PyPI)](https://junglewise.ai/threats/technologies/pypi-gitpython). Vendors: [PyPI](https://junglewise.ai/threats/vendors/pypi).

## Quick answers

**Is CVE-2024-22190 exploited in the wild?** No. Junglewise Threat Intelligence has no report of CVE-2024-22190 being exploited in the wild.

**How severe is CVE-2024-22190?** Low severity, with a CVSS score of 3.1, published 11 January 2024.

**Which products and versions are affected?** gitpython (PyPI) ECOSYSTEM:introduced=0,fixed=3.1.41, GIT:introduced=0,fixed=ef3192cc414f2fd9978908454f6fd95243784c7f|ECOSYSTEM:introduced=0,fixed=3.1.41.

**Is there a fix for CVE-2024-22190?** Yes. gitpython (PyPI): upgrade to 3.1.41 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.

**How is CVE-2024-22190 attacked?** It is attacked with local access.

**Am I affected by CVE-2024-22190?** Check whether you run gitpython (PyPI) at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

## How to fix

- gitpython (PyPI): upgrade to 3.1.41 or later

  ```sh
  pip install "gitpython>=3.1.41"
  ```


## Technical details

This is an incomplete fix for CVE-2023-40590 affecting path search on Windows. The vulnerability exists in two scenarios: (1) when GitPython uses a shell to execute git commands with shell=True or Git.USE_SHELL=True, the Windows cmd.exe shell performs path lookup and can find malicious git.exe in the current directory or repository root, and (2) when running git hooks, GitPython uses bash.exe without safeguards to prevent loading a malicious bash.exe from the current directory. Attack vectors require user interaction (cloning/checking out an untrusted repository or reviewing a malicious branch) and are limited to Windows systems. An attacker can achieve arbitrary code execution with the privileges of the process running GitPython. The fix was released in GitPython 3.1.41 by properly setting the NoDefaultCurrentDirectoryInExePath environment variable in subprocess calls.

## Affected products

- GitPython GitPython <= 3.1.40

## Identifiers

- CVE-2024-22190
- GHSA-2mqj-m65w-jghx
- PYSEC-2024-4

## Timeline

- 2024-01-10: disclosed
- 2024-01-10: patched: Fixed in version 3.1.41

## References

- [https://github.com/gitpython-developers/GitPython/security/advisories/GHSA-2mqj-m65w-jghx](https://github.com/gitpython-developers/GitPython/security/advisories/GHSA-2mqj-m65w-jghx)

## Related threats

- [GitPython command wrappers omit unsafe protocol and option checks](https://junglewise.ai/threats/cve-2026-110857-gitpython-command-wrappers-omit-unsafe-protocol-and-option)
- [GitPython submodule path traversal to arbitrary hook execution](https://junglewise.ai/threats/cve-2026-114145-gitpython-is-a-python-library-used-to-interact-with-git)
- [GitPython symlink following in Submodule.move()](https://junglewise.ai/threats/cve-2026-110860-gitpython-from-3-1-62-before-3-2-0-contains-a-symlink-following)
- [GitPython argument injection in Head.checkout()](https://junglewise.ai/threats/cve-2026-110859-gitpython-before-3-2-0-contains-an-argument-injection)
- [GitPython remote code execution in Remote.pull() refspec argument](https://junglewise.ai/threats/cve-2026-110858-gitpython-from-3-1-30-before-3-2-0-contains-a-remote-code)
