Advisory Database
  • Advisories
  • Dependency Scanning
  1. pypi
  2. ›
  3. GitPython
  4. ›
  5. GHSA-2f96-g7mh-g2hx

GHSA-2f96-g7mh-g2hx: GitPython: Command Injection via git long-option prefix abbreviation bypass of CVE-2026-42215 blocklist

July 21, 2026

The 3.1.47 fix for CVE-2026-42215 blocks dangerous git options (--upload-pack, --config, -c, -u for clone; --upload-pack for fetch/pull; --receive-pack, --exec for push) so callers cannot reach command-executing options unless they pass allow_unsafe_options=True.

The fix canonicalizes an option name along one axis (underscore→hyphen via dashify) and checks it against an exact-match dict. It does not account for git’s unambiguous long-option prefix abbreviation. Git accepts any unambiguous prefix of a long option (--upload-p, --upload-pa, --upload-pac all resolve to --upload-pack). So a kwarg key like upload_p canonicalizes to upload-p, misses the blocklist dict, and is emitted to git as --upload-p=<value> → executed as --upload-pack=<value> → command injection, in the default allow_unsafe_options=False configuration.

References

  • github.com/advisories/GHSA-2f96-g7mh-g2hx
  • github.com/gitpython-developers/GitPython/commit/56806080c1348749b07daa4a2024ce47b3cad285
  • github.com/gitpython-developers/GitPython/pull/2161
  • github.com/gitpython-developers/GitPython/releases/tag/3.1.51
  • github.com/gitpython-developers/GitPython/security/advisories/GHSA-2f96-g7mh-g2hx

Code Behaviors & Features

Detect and mitigate GHSA-2f96-g7mh-g2hx with GitLab Dependency Scanning

Secure your software supply chain by verifying that all open source dependencies used in your projects contain no disclosed vulnerabilities. Learn more about Dependency Scanning →

Affected versions

All versions before 3.1.51

Fixed versions

  • 3.1.51

Solution

Upgrade to version 3.1.51 or above.

Impact 8.8 HIGH

CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H

Learn more about CVSS

Weakness

  • CWE-184: Incomplete List of Disallowed Inputs
  • CWE-78: Improper Neutralization of Special Elements used in an OS Command ('OS Command Injection')

Source file

pypi/GitPython/GHSA-2f96-g7mh-g2hx.yml

Spotted a mistake? Edit the file on GitLab.

  • Site Repo
  • About GitLab
  • Terms
  • Privacy Statement
  • Contact

Page generated Wed, 22 Jul 2026 00:18:11 +0000.