Description
go-git is an extensible git implementation library written in pure Go. Prior to 5.19.1 and 6.0.0-alpha.4, go-git's SSH transport constructs the remote exec command by wrapping the repository path in single quotes without escaping single quotes embedded inside the path. A repository path containing a single quote can therefore break out of the quoted region in the exec command and be appended as additional shell tokens. This vulnerability is fixed in 5.19.1 and 6.0.0-alpha.4.
Published: 2026-05-27
Score: 2.3 Low
EPSS: n/a
KEV: No
Impact: n/a
Action: n/a
AI Analysis

Impact

The vulnerability is in go‑git, a Go library that implements Git. Prior to version 5.19.1 and 6.0.0‑alpha.4 the library builds a remote exec command for SSH transport by wrapping the repository path in single quotes, but it fails to escape any single quotes that occur inside the path. An attacker who can provide a path containing a single quote can break out of the quoted region and inject additional shell tokens. Because the exec command runs on the remote host, this can lead to arbitrary command execution on that host, potentially compromising confidentiality, integrity, or availability of the remote system. The weakness is a classic example of an improper string handling flaw (CWE‑116).

Affected Systems

Affected products are the go‑git library under the go‑git:go‑git namespace. Versions older than 5.19.1 for the stable 5.x branch and older than 6.0.0‑alpha.4 for the 6.x pre‑release branch are vulnerable. Applications that embed these versions, especially those that clone or fetch from arbitrary repositories over SSH, must address this issue.

Risk and Exploitability

The CVSS base score is 2.3, indicating a low overall risk. The EPSS score is not available and the vulnerability is not listed in CISA KEV, so there is no public evidence of exploitation. The risk is linked to the attacker’s ability to supply a malicious repository path when using the SSH transport. If the tool is run with elevated privileges or on untrusted servers, an injected command could run with those privileges. Therefore, while the likelihood of a widespread exploit is low, the potential impact if exploited can be severe.

Generated by OpenCVE AI on May 27, 2026 at 19:40 UTC.

Remediation

No vendor fix or workaround currently provided.

OpenCVE Recommended Actions

  • Upgrade the go‑git library to version 5.19.1 or later for the 5.x series, or to 6.0.0‑alpha.4 or newer for the 6.x series, where the issue is fixed.
  • If an upgrade is not feasible, sanitize any repository path supplied to go‑git by escaping single quotes (for example, replace each single quote with '\\'' or use a dedicated escaping routine) before passing it to the library.
  • Ensure the SSH daemon on the remote host is configured to restrict the commands that can be executed via SSH, such as by using ForceCommand or a command whitelist, to limit damage if a command injection occurs.

Generated by OpenCVE AI on May 27, 2026 at 19:40 UTC.

Tracking

Sign in to view the affected projects.

Advisories
Source ID Title
Github GHSA Github GHSA GHSA-m7cr-m3pv-hgrp go-git: Improper single-quote escaping in go-git SSH transport
History

Thu, 28 May 2026 04:00:00 +0000

Type Values Removed Values Added
First Time appeared Go-git
Go-git go-git
Vendors & Products Go-git
Go-git go-git

Wed, 27 May 2026 15:15:00 +0000

Type Values Removed Values Added
Description go-git is an extensible git implementation library written in pure Go. Prior to 5.19.1 and 6.0.0-alpha.4, go-git's SSH transport constructs the remote exec command by wrapping the repository path in single quotes without escaping single quotes embedded inside the path. A repository path containing a single quote can therefore break out of the quoted region in the exec command and be appended as additional shell tokens. This vulnerability is fixed in 5.19.1 and 6.0.0-alpha.4.
Title go-git: Improper single-quote escaping in go-git SSH transport
Weaknesses CWE-116
References
Metrics cvssV4_0

{'score': 2.3, 'vector': 'CVSS:4.0/AV:N/AC:L/AT:P/PR:N/UI:P/VC:N/VI:N/VA:N/SC:L/SI:L/SA:L'}


cve-icon MITRE

Status: PUBLISHED

Assigner: GitHub_M

Published:

Updated: 2026-05-27T14:59:17.441Z

Reserved: 2026-05-12T19:00:14.600Z

Link: CVE-2026-45570

cve-icon Vulnrichment

No data.

cve-icon NVD

Status : Received

Published: 2026-05-27T15:16:30.240

Modified: 2026-05-27T15:16:30.240

Link: CVE-2026-45570

cve-icon Redhat

No data.

cve-icon OpenCVE Enrichment

Updated: 2026-05-28T03:45:05Z

Weaknesses