Safeguard
Vulnerability Analysis•

CVE-2026-73623: High Command Execution in GitPython Clone

GitPython before 3.1.54 misses the template option in its unsafe clone options list, enabling hook execution during clone. Upgrade to 3.1.54 or later.

Safeguard Security Team
4 min read

CVE-2026-73623 is an OS command injection flaw (CWE-78) in GitPython, the Python library for driving git. The list of unsafe clone options omits the template option, which can lead to hook execution during a clone. The record rates it High at 7.5. Version 3.1.54 fixes it, so upgrade.

What's affected

The record says GitPython before 3.1.54 is affected, and the GitHub advisory (GHSA-6p8h-3wgx-97gf) lists 3.1.54 and later as patched.

The exposure depends on how your code calls clone. The advisory says a caller who can influence clone options can reach command execution even in the default configuration, where allow_unsafe_options is false. It also notes that the attacker needs a directory containing hook scripts that git can read, which is part of why the record uses high attack complexity.

Severity, as two sources state it. The record gives 7.5 (High) under CVSS 3.1. VulnCheck lists it as High at 7.7 under CVSS 4.0. Both sit in the same band.

How to check if you're exposed

Check the installed version of the package in each environment that uses it.

pip show gitpython
pip list | grep -i gitpython
pip freeze | grep -i gitpython

Also check lock files and container images, since GitPython often arrives through tools such as automation scripts, notebooks and CI helpers. Then search your own code for the entry point named in this CVE and ask a plain question: can a user, a file or a network source influence the options passed to it? If the options are fixed strings in your code, the practical risk is low. If they are built from outside input, treat the issue as urgent.

What to do now

  1. Upgrade GitPython to 3.1.54 or later, and rebuild images and virtual environments that pin the old version.
  2. Do not pass user controlled strings as clone options. Allow only the options you list yourself.
  3. If you must clone untrusted repositories, run the clone in a sandbox with no credentials and no access to internal networks.
  4. Keep allow_unsafe_options at its default of false. The advisory notes that the default does not cover this option until you upgrade.
  5. Add GitPython to your software inventory with the version, so the next advisory is easy to match.

Why it matters

The weakness is classed as OS command injection, CWE-78. GitPython blocks some dangerous git options through a denylist. According to the advisory, the list contained upload pack and config style options but not template. Git copies the contents of the template directory's hooks folder into the new repository and runs the post-checkout hook while the clone completes, so a hook planted in the template runs code.

Denylists of command line options are fragile, because git has many options and gains more over time. The sturdier approach is an allowlist of the few options a caller is permitted to pass. A sibling issue, covered in CVE-2026-76218, affects the repository init call in the same library, which shows the same lesson applying to a second code path. KEV status is false.

Try it yourself

Click through it at your own pace, or open it full screen.

Quick check

Does it matter if I only clone my own repositories?

If the clone options are fixed in your code and never come from outside, the risk is low. Upgrade anyway, because the library is often shared by other tools on the same machine.

What does the template option do?

It tells git to copy files from a given directory into the new repository, including hook scripts. Hooks run when git operations happen, which is how code runs.

Sources

Last reviewed: 18 October 2026.

Never miss an update

Weekly insights on software supply chain security, delivered to your inbox.

Self-healing security runs on Safeguard.

Your first fix PR is minutes away.

No sales call required, even your agent can complete the purchase over MCP.