/

CVE-2026-73620

Severity:

HIGH RISK

(8.1)

Path Traversal (CWE-22) in GitPython Git Operations

CVE-2026-73620

Analyzed

Vulnerability type

Category:

Path Traversal and Argument Injection

CWE:

CWE-22

Impact:

Arbitrary File Read and File Overwrite

Severity:

HIGH RISK

(8.1)

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 does not adequately restrict Git options forwarded through IndexFile.checkout() and TagReference.create(), allowing attacker-controlled keyword arguments to influence file and repository operations. Depending on the reachable API and supplied options, an attacker may overwrite arbitrary files with repository content or read arbitrary files through in-band results.

Affected context

The vulnerability occurs in applications that use GitPython's affected checkout or tag-creation APIs and pass attacker-influenced keyword arguments into Git commands. Risk increases when untrusted users can control repository references, operation parameters, or other input that reaches these APIs without strict option filtering and path restrictions.

Exploit preconditions

  • Attack surface: Applications or services exposing GitPython repository operations
  • Required access: Ability to influence arguments, references, or request data forwarded to the affected APIs
  • Trigger point: Invocation of IndexFile.checkout() or TagReference.create()
  • Why exploitation is possible: Unsafe Git options can be forwarded through keyword arguments, allowing command behavior to escape intended path and data boundaries

Why this happens

The underlying issue is insufficient separation between application parameters and Git command-line options. When keyword arguments are forwarded without allowlisting and contextual validation, attacker-controlled values may alter file-selection, output, or path-handling behavior. This is associated with CWE-22: Improper Limitation of a Pathname to a Restricted Directory, because the resulting Git operation may access or modify files outside the intended repository-controlled scope.

Potential impact

  • An attacker may overwrite arbitrary files with repository content
  • Sensitive files may be read and returned through application responses
  • Application configuration or security controls could be modified
  • Repository content or deployment workflows could be manipulated
  • Subsequent compromise could occur if overwritten files are trusted or executed

General mitigation guidance

Mitigation generally focuses on preventing untrusted values from becoming Git options or unrestricted paths.

Common defensive patterns include:

  • Allowlisting supported operation parameters instead of forwarding arbitrary keyword arguments
  • Separating data values from command options and rejecting option-like input where it is not expected
  • Constraining all file operations to an explicitly permitted repository or workspace
  • Applying canonical-path checks and preventing traversal outside approved directories
  • Returning only narrowly scoped operation results and avoiding unnecessary file content disclosure
  • Running repository-processing components with least-privilege filesystem and process permissions
  • Treating repositories and references supplied by users as untrusted input

How teams detect issues like this

Useful detection approaches include:

  • Static analysis rules identifying GitPython calls that forward user-controlled keyword arguments
  • Code review checks for unrestricted checkout() or create() parameters and option-like strings
  • Tests that verify repository operations cannot access paths outside an approved workspace
  • Runtime monitoring for unexpected file writes, reads, or Git option patterns
  • Policy enforcement requiring parameter allowlists and canonical-path validation at repository boundaries
  • Automated code review tools configured to flag command-option injection and filesystem-boundary violations

Sources

SourceLink
github.comgithub.com/gitpython-developers/GitPython/security/advisories/GHSA-3f7w-8rr8-f37f
vulncheck.comvulncheck.com/advisories/gitpython-before-arbitrary-file-overwrite-and-read

Frequently asked

questions

It can be remotely exploitable when a network-facing application exposes the affected GitPython operations and allows remote input to influence forwarded arguments.

An attacker generally needs access to an application feature, service endpoint, hook, or workflow that passes attacker-controlled values to the affected APIs. The exact requirement depends on the host application's authorization model.

The safest pattern is to prevent arbitrary option forwarding, allowlist expected parameters, validate paths against a permitted workspace, and restrict filesystem privileges.

Treat repository references and operation arguments as untrusted, separate data from command options, use boundary-focused tests, and enforce static-analysis and code-review policies for filesystem and Git command handling.

Find out what's already
exploitable in your codebase.