/

CVE-2026-67324

Severity:

CRITICAL RISK

(9.8)

Command Injection (CWE-78) via Git clone helper in GitPython

CVE-2026-67324

Analyzed

Vulnerability type

Category:

Command Injection

CWE:

CWE-78

Impact:

Remote Code Execution during Git clone operations

Severity:

CRITICAL RISK

(9.8)

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 3.1.50 contains a command injection weakness where joined short options like -u<helper> are not correctly recognized by the unsafe-option gate for Repo.clone_from.

Applications that pass attacker-controlled clone options with allow_unsafe_options=False may still allow an attacker to invoke arbitrary Git helper commands during clone, leading to potential remote code execution in the cloning environment.

Affected context

This vulnerability affects applications that:

  • Use GitPython 3.1.50 to perform Git clone operations
  • Rely on Repo.clone_from(..., multi_options=..., allow_unsafe_options=False) for safety
  • Accept or forward user- or network-supplied clone options into multi_options

The issue arises specifically when Git short options are passed in joined form (e.g., -uhelper or -u/path/to/helper), which are not blocked by the intended guard against --upload-pack / -u.

Exploit preconditions

  • Attack surface: Any feature that triggers Repo.clone_from and accepts untrusted or semi-trusted clone options (e.g., user-specified mirror URLs or advanced options).
  • Required access: Ability to influence or control entries in the multi_options argument, directly or indirectly.
  • Trigger point: Invocation of Repo.clone_from(..., multi_options=..., allow_unsafe_options=False) in GitPython 3.1.50.
  • Why exploitation is possible: The unsafe-option filter inspects explicit forms of forbidden options (such as --upload-pack or -u followed by a value) but fails to normalize or detect joined short-option variants like -u<helper>, allowing Git to execute the supplied helper as part of the clone process.

Why this happens

The underlying bug is an incomplete validation and normalization of command-line options before they are passed to the underlying Git process.

GitPython's "unsafe-option" gate is intended to prevent dangerous Git options such as --upload-pack (-u) from being used when allow_unsafe_options=False.

However, the implementation assumes options will appear in separated forms (e.g., -u, <value>), and does not account for the valid Git syntax where short options can be immediately followed by their values (e.g., -uhelper).

This gap allows attacker-controlled strings to reintroduce a blocked capability in a syntactically different but semantically equivalent way, aligning with CWE-78: Improper Neutralization of Special Elements used in an OS Command, because external input influences which helper command Git executes.

Potential impact

  • Attackers can cause Git to execute an arbitrary upload-pack-like helper during clone.
  • Cloning processes may run attacker-controlled binaries or scripts on the host.
  • Compromised environments can lead to remote code execution under the privileges of the application using GitPython.
  • Subsequent data exfiltration, repository tampering, or deployment pipeline compromise may occur.

General mitigation guidance

Effective mitigation focuses on hardening how clone options are handled and reducing trust in caller-controlled arguments:

  • Normalize and strictly validate any user-influenced Git options before passing them to GitPython, rejecting or sanitizing dangerous flags and joined forms.
  • Treat multi_options as a privileged parameter and avoid populating it directly from user input; use allowlists of known-safe options rather than blocklists.
  • Run Git operations under least-privilege accounts and within constrained environments (e.g., sandboxes, containers) to reduce impact if a helper is executed.
  • Centralize Git invocation logic so that security checks around dangerous options (--upload-pack, -u, and equivalents) are applied consistently across the codebase.

How teams detect issues like this

Detection efforts can combine static and runtime approaches:

  • Static analysis: Search for uses of Repo.clone_from or related GitPython APIs that pass unvalidated or user-controlled values into multi_options, especially when allow_unsafe_options=False is assumed to be sufficient protection.
  • Code review: Flag patterns where clone options are assembled from HTTP parameters, configuration files, or other untrusted sources without explicit normalization or allowlisting.
  • Policy enforcement: Define internal guidelines or lints that disallow direct propagation of user input into Git command options and require explicit security review for Git helper usage.
  • Runtime monitoring: Monitor execution of unexpected Git helper binaries or anomalous child processes spawned during clone operations, aiding in early detection of exploit attempts.

Sources

SourceLink
github.comgithub.com/gitpython-developers/GitPython/security/advisories/GHSA-v396-v7q4-x2qj
vulncheck.comvulncheck.com/advisories/gitpython-authentication-bypass-via-joined-short-options

Frequently asked

questions

Exploitability depends on whether an application forwards untrusted data into multi_options. If clone options are fully controlled by the application and not influenced by users or external services, practical exploitability is low; if users can affect these options, the risk can be significant.

No direct shell access is required. The essential requirement is control over the clone options supplied to GitPython. This control may come from authenticated features (e.g., advanced clone settings) or misconfigured services that trust external parameters.

Treat multi_options as a sensitive interface: normalize options, enforce strict allowlists, and avoid relying solely on built-in "unsafe option" gates. Ensure that any equivalent forms of dangerous options (like joined short options) are either prohibited or never constructed from untrusted data.

Adopt a defensive design where wrapper libraries around command-line tools normalize and canonicalize input before validation, prefer allowlisting over blocklisting of options, and enforce security reviews for changes that affect process spawning or helper configuration. Integrating static checks and CI rules around dangerous arguments helps catch similar mistakes early.

Find out what's already
exploitable in your codebase.