/

CVE-2026-73623

Severity:

HIGH RISK

(7.5)

OS Command Injection (CWE-78) in GitPython Cloning

CVE-2026-73623

Analyzed

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-78

Impact:

Arbitrary Command Execution

Severity:

HIGH RISK

(7.5)

CVSS version:

3.1

Catch this CVE while code is being written

Detect vulnerable code directly in pull requests, so CVEs are fixed before merge.

Summary

GitPython contains an incomplete denylist for options passed to Git clone operations, allowing the template option to reach the underlying Git command. If an attacker can influence clone parameters and reference a directory containing malicious Git hooks, they may achieve arbitrary command execution when the clone process runs those hooks.

Affected context

The vulnerability occurs in applications that use GitPython's clone functionality while accepting attacker-influenced clone options or repository-related input. It becomes risky when the incomplete option filtering permits template directories to be selected and the resulting Git operation processes hooks from that directory with the privileges of the calling application.

Exploit preconditions

  • Attack surface: GitPython clone operations that expose or derive options from untrusted input
  • Required access: Ability to influence clone parameters, repository metadata, or a referenced template directory
  • Trigger point: Execution of the Git clone workflow and subsequent hook processing
  • Why exploitation is possible: The option denylist does not comprehensively prevent template-directory selection, allowing attacker-controlled hook content to be executed by Git

Why this happens

The underlying bug is incomplete validation of arguments passed from a Python wrapper to an operating-system command. GitPython attempts to deny dangerous Git options, but omitting a security-sensitive option leaves an alternate path for attacker-controlled behavior to reach Git's hook-processing mechanisms. This maps to CWE-78: Improper Neutralization of Special Elements used in an OS Command, because untrusted input can influence command behavior and result in command execution.

Potential impact

  • An attacker may execute arbitrary commands with the privileges of the GitPython process.
  • A compromised application process could expose repository contents or environment secrets.
  • The host or container running the clone operation could be modified.
  • Downstream build, deployment, or supply-chain workflows could be affected.

General mitigation guidance

Mitigation generally focuses on eliminating attacker control over Git command options and treating repository-related content as untrusted.

Common defensive patterns include:

  • Use narrowly defined clone APIs and allowlists rather than denylisting individual options.
  • Reject or ignore template-directory and hook-related options unless explicitly required.
  • Separate untrusted repository processing into isolated, least-privileged environments.
  • Disable or constrain hook execution where the workflow permits.
  • Apply strict input validation, process isolation, filesystem restrictions, and minimal credentials to clone workers.
  • Avoid passing user-controlled strings directly into subprocess or Git command construction.

How teams detect issues like this

Organizations can identify related risks through:

  • Static analysis for subprocess calls and wrapper APIs that concatenate or forward untrusted Git arguments.
  • Code review checks for denylist-based command-option filtering.
  • Tests that verify security-sensitive Git options are rejected under unexpected input conditions.
  • Policy enforcement requiring allowlisted repository operations and isolated clone environments.
  • Runtime monitoring for unexpected child processes, Git hook execution, or clone activity involving unusual template paths.

Automated security review tools may help flag command construction and incomplete argument-validation patterns.

Sources

SourceLink
github.comgithub.com/gitpython-developers/GitPython/security/advisories/GHSA-6p8h-3wgx-97gf
vulncheck.comvulncheck.com/advisories/gitpython-before-remote-code-execution-via-template

Frequently asked

questions

It can be remotely exploitable when a service exposes clone functionality and allows remote users to influence clone options, repository inputs, or related filesystem content. In other deployments, local or authenticated access may be required.

The attacker generally needs a way to control or influence parameters used by the GitPython clone operation and cause the affected workflow to run. The exact access depends on how the application exposes repository cloning.

Do not rely on a partial denylist. Use allowlisted clone arguments, reject template and hook-related controls from untrusted input, and isolate clone operations with least privilege.

Treat Git options, repository metadata, and hook content as untrusted; use security-focused tests for argument forwarding, monitor unexpected child processes, and enforce isolated execution for repository processing.

Find out what's already
exploitable in your codebase.