/

CVE-2026-73625

Severity:

HIGH RISK

(8.8)

OS Command Injection (CWE-78) in GitPython Method Calls

CVE-2026-73625

Analyzed

Vulnerability type

Category:

OS Command Injection

CWE:

CWE-78

Impact:

Remote Code Execution

Severity:

HIGH RISK

(8.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 versions before 3.1.54 contain an option-validation bypass that can allow crafted Git options to reach sensitive command execution paths. If an attacker can control option dictionaries passed to affected GitPython methods, they may execute arbitrary operating-system commands through the Git upload-pack option.

Affected context

The vulnerability occurs in GitPython integrations that use the affected option-handling logic in versions before 3.1.54. It applies to methods such as clone_from, fetch, pull, push, ls_remote, iter_commits, blame, and archive when attacker-influenced keyword arguments or option dictionaries are accepted and forwarded to Git subprocesses.

Exploit preconditions

  • Attack surface: Application code invoking affected GitPython methods
  • Required access: Ability to influence Git option dictionaries or single-character keyword argument values
  • Trigger point: Git command construction and execution through an affected API method
  • Why exploitation is possible: The check_unsafe_options guard can be bypassed, allowing a command-affecting option to reach the underlying Git process

Why this happens

The underlying bug is an incomplete validation of Git options. The guard checks option representations but does not reliably account for options smuggled through single-character keyword argument values, allowing attacker-controlled arguments to bypass the intended safety boundary.

This maps to CWE-78: Improper Neutralization of Special Elements used in an OS Command, because untrusted input can influence arguments interpreted by an operating-system command or subprocess.

Potential impact

  • Attackers may execute arbitrary operating-system commands in the application process context
  • Application credentials, source code, or repository data could be exposed
  • The host or execution environment could be modified
  • Compromised processes may be used for lateral movement or supply-chain tampering

General mitigation guidance

Mitigation generally focuses on preventing untrusted data from becoming Git command options and ensuring subprocess boundaries remain tightly controlled.

Common defensive patterns include:

  • Use a maintained GitPython release line containing robust option validation
  • Allowlist supported Git options instead of forwarding arbitrary dictionaries
  • Treat repository URLs, refspecs, and command parameters as untrusted input
  • Separate user-controlled values from command construction and validate them against expected schemas
  • Run Git operations with least-privilege accounts, restricted filesystem access, and minimal environment credentials
  • Prefer fixed argument arrays and disable unnecessary subprocess capabilities where practical

How teams detect issues like this

Organizations can look for this vulnerability through:

  • Static analysis rules identifying attacker-controlled dictionaries passed to GitPython command methods
  • Code review checks for dynamic option construction, especially single-character keyword names and values
  • Inventory searches for affected GitPython versions and uses of the listed methods
  • Runtime monitoring of unexpected Git subprocess arguments, repository access, or child-process creation
  • Policy enforcement requiring allowlisted Git options and security review for subprocess wrappers

Automated dependency and code-review tools can help identify vulnerable library usage and unsafe argument-flow patterns.

Sources

SourceLink
github.comgithub.com/gitpython-developers/GitPython/security/advisories/GHSA-r9mr-m37c-5fr3
vulncheck.comvulncheck.com/advisories/gitpython-before-remote-code-execution-via-kwarg-value-smuggling

Frequently asked

questions

It can be exploitable through a network-facing application when that application accepts attacker-controlled repository or Git option data and passes it to affected GitPython methods. The exact exposure depends on the application's input flow and isolation controls.

An attacker generally needs a way to influence the option dictionary or related arguments supplied to an affected GitPython API call. Direct access to the host is not necessarily required if a reachable service exposes this functionality.

Use a maintained library release with corrected option validation, restrict accepted Git options to an explicit allowlist, and prevent untrusted values from controlling subprocess arguments.

Apply strict input schemas, review subprocess wrappers for argument-injection risks, monitor child-process execution, and run repository operations with least privilege and limited credentials.

Find out what's already
exploitable in your codebase.