/

CVE-2026-73622

Severity:

HIGH RISK

(7.5)

Environment Variable Exposure (CWE-200) in GitPython

CVE-2026-73622

Analyzed

Vulnerability type

Category:

Sensitive Information Exposure

CWE:

CWE-200

Impact:

Secret Exfiltration

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 URL handling may expand environment variable references when creating remotes or adding submodules. If an attacker can influence a repository URL and a fetch or pull later occurs, expanded values may be written to Git configuration files and sent to an attacker-controlled host, exposing secrets.

Affected context

This vulnerability occurs in GitPython workflows that use Remote.create() or Submodule.add() with attacker-influenced repository URLs. It becomes risky when environment variable expansion remains enabled, sensitive values are present in the process environment, and the resulting remote or submodule URL is later used during fetch, pull, or related Git operations.

Exploit preconditions

  • Attack surface: GitPython APIs that process remote or submodule URLs
  • Required access: Ability to supply or influence a repository URL, or control repository metadata consumed by the application
  • Trigger point: Remote creation, submodule configuration, or a subsequent fetch or pull operation
  • Why exploitation is possible: Variable references in URLs may be expanded using process environment values and persisted in Git metadata before being transmitted to a remote destination

Why this happens

The underlying issue is insufficient separation between URL data and environment-variable expansion during Git configuration handling. When URL strings are interpreted with expansion enabled, attacker-controlled references can resolve to sensitive process environment values and become part of .git/config or .gitmodules. This behavior maps to CWE-200: Exposure of Sensitive Information to an Unauthorized Actor, because confidential data may be disclosed through a network request controlled by an attacker.

Potential impact

  • Environment variables containing credentials, tokens, or other secrets may be disclosed
  • Sensitive values may be persisted in repository configuration files
  • Credentials could be transmitted to attacker-controlled hosts
  • Downstream systems may be compromised if exposed secrets are reused
  • Repository operations may facilitate broader supply-chain or data-access risks

General mitigation guidance

Mitigation generally focuses on treating repository URLs and repository metadata as untrusted data.

Common defensive patterns include:

  • Disable environment-variable expansion when creating remotes or submodules
  • Use URL parsing and storage behavior that preserves literal input
  • Validate and allowlist permitted schemes, hosts, and repository locations
  • Avoid placing secrets in process environments used by repository operations
  • Apply least privilege to tokens and service identities available to Git processes
  • Restrict outbound network access from repository-processing workloads
  • Redact sensitive values from logs and configuration artifacts

How teams detect issues like this

Organizations can detect this class of issue through:

  • Static analysis rules identifying GitPython URL APIs used with untrusted input
  • Code review checks for environment expansion, interpolation, or templating in repository URLs
  • Tests that verify variable references remain literal across remote and submodule operations
  • Monitoring for unexpected outbound Git traffic or connections to unapproved hosts
  • Secret-scanning of .git/config, .gitmodules, logs, and process-generated artifacts
  • Policy enforcement requiring repository operations to use approved destinations and restricted environments

Sources

SourceLink
github.comgithub.com/gitpython-developers/GitPython/commit/8ac5a30519b6f4af85398b9b9d7064ff4d452da2
github.comgithub.com/gitpython-developers/GitPython/security/advisories/GHSA-94p4-4cq8-9g67
vulncheck.comvulncheck.com/advisories/gitpython-before-environment-variable-exfiltration-via-remote-add

Frequently asked

questions

It can be exploitable through an application that accepts attacker-controlled repository URLs or repository metadata and later performs Git operations. Direct remote exploitation is not generally possible without such an integrating application or access path.

The attacker generally needs to influence a remote or submodule URL and have the target process perform a fetch, pull, or related operation. The presence of sensitive environment variables increases the potential impact.

Treat URLs as untrusted data, disable environment-variable expansion during URL handling, validate destinations, and minimize the secrets available to repository-processing processes.

Use literal URL handling, enforce host and scheme allowlists, restrict outbound connectivity, apply least privilege to credentials, and test that repository metadata cannot trigger interpolation or secret disclosure.

Find out what's already
exploitable in your codebase.