# CVE-2026-42284: GitPython argument injection in clone and submodule update

Source: https://junglewise.ai/threats/cve-2026-42284-gitpython-argument-injection-in-clone-and-submodule-update  
Publisher: Junglewise Threat Intelligence, https://junglewise.ai/threats  
Published: 2026-05-07. Updated: 2026-05-13  
License: CC BY 4.0 with a link back

CVE-2026-42284 · Severity: high · CVSS 8.1 · Published 2026-05-07

GitPython is a popular Python library used to interact with Git repositories. A vulnerability in how it handles command-line options allows an attacker to bypass security checks and inject malicious configuration settings during a repository clone operation. If an application uses GitPython to clone repositories based on user-provided input, an attacker could execute arbitrary code on the system.

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

## Quick answers

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

**How severe is CVE-2026-42284?** High severity, with a CVSS score of 8.1, published 7 May 2026.

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

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

**How is CVE-2026-42284 attacked?** It is attacked over the network, in a software library.

**Am I affected by CVE-2026-42284?** Check whether you run Gitpython Project Gitpython or 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.47 or later

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


## Technical details

An argument injection vulnerability exists in GitPython's `_clone()` and `Submodule.update()` functions. The library performs security validation on the `multi_options` list before it is transformed by `shlex.split`. An attacker can provide a single string containing multiple arguments (e.g., '--branch main --config core.hooksPath=/path'); because the validation check only uses `startswith`, it fails to detect the forbidden `--config` flag embedded later in the string. When the string is subsequently split and passed to the Git binary, the injected configuration is applied, allowing the attacker to define malicious hooks that execute arbitrary code during the clone process. This is fixed in version 3.1.47.

## Affected products

- gitpython-developers GitPython < 3.1.47

## Identifiers

- CVE-2026-42284
- GHSA-x2qx-6953-8485
- PYSEC-2026-2161

## Timeline

- 2026-04-22: disclosed
- 2026-04-25: advisory
- 2026-04-25: patched: Released in version 3.1.47

## References

- [https://api.github.com/users/Texuguinho1234](https://api.github.com/users/Texuguinho1234)
- [https://github.com/Texuguinho1234](https://github.com/Texuguinho1234)
- [https://api.github.com/users/Texuguinho1234/gists%7B/gist_id%7D](https://api.github.com/users/Texuguinho1234/gists%7B/gist_id%7D)
- [https://api.github.com/users/Texuguinho1234/repos](https://api.github.com/users/Texuguinho1234/repos)
- [https://avatars.githubusercontent.com/u/180200014?v=4](https://avatars.githubusercontent.com/u/180200014?v=4)
- [https://api.github.com/users/Texuguinho1234/events%7B/privacy%7D](https://api.github.com/users/Texuguinho1234/events%7B/privacy%7D)

## 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)
