Skip to main content

go-git CVE-2026-45570

| EUVDEUVD-2026-32546 LOW
Improper Encoding or Escaping of Output (CWE-116)
2026-05-19 https://github.com/go-git/go-git GHSA-m7cr-m3pv-hgrp
2.3
CVSS 4.0 · GitHub Advisory

Severity by source

GitHub Advisory PRIMARY
2.3 LOW
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/E:X/CR:X/IR:X/AR:X/MAV:X/MAC:X/MAT:X/MPR:X/MUI:X/MVC:X/MVI:X/MVA:X/MSC:X/MSI:X/MSA:X/S:X/AU:X/R:X/V:X/RE:X/U:X

Primary rating from GitHub Advisory · only source for this CVE.

CVSS VectorGitHub Advisory

Attack Vector
Network
Attack Complexity
Low
Privileges Required
None
User Interaction
P
Scope
X

Lifecycle Timeline

3
CVSS changed
May 27, 2026 - 19:37 NVD
2.3 (LOW)
Source Code Evidence Fetched
May 19, 2026 - 16:00 vuln.today
Analysis Generated
May 19, 2026 - 16:00 vuln.today

DescriptionGitHub Advisory

Impact

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. This diverges from canonical Git, which shell-quotes the path through sq_quote_buf so that an embedded ' becomes the '\'' close-escape-reopen sequence and the whole path round-trips as a single quoted argument.

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. On SSH servers that evaluate the exec command through a shell (for example a user account whose login shell is /bin/sh or /bin/bash, or a ForceCommand wrapper that re-evaluates $SSH_ORIGINAL_COMMAND), those additional tokens execute in that account's command-execution context. SSH servers that tokenize the exec command without shell evaluation, including the canonical git-shell setup, are not affected.

The vulnerable behaviour is on the SSH server side, not in go-git: the same bytes can be produced by any SSH client. The change in go-git is defense-in-depth that restores parity with canonical Git's wire format and prevents go-git from being a vehicle for reaching shell-evaluating servers through attacker-influenced repository paths.

Patches

Users should upgrade to a patched version in order to mitigate this issue. The fix ports sq_quote_buf from canonical Git into go-git's SSH transport so that the wire output is byte-identical to what git itself would send for the same input.

Versions prior to v5 are likely to be affected, users are recommended to upgrade to a supported go-git version.

Credit

Thanks to @N0zoM1z0 for reporting this to the go-git project. :bow:

AnalysisAI

Shell command injection in go-git's SSH transport allows attackers who control repository path values to execute arbitrary shell commands on SSH servers that evaluate exec commands through a login shell. go-git wraps repository paths in single quotes without escaping embedded single-quote characters, diverging from canonical Git's sq_quote_buf behavior. When a go-git client connects to an SSH server whose exec command passes through /bin/sh, /bin/bash, or a ForceCommand wrapper that re-evaluates $SSH_ORIGINAL_COMMAND, an attacker-influenced path containing a single quote can break out of the quoted region and append arbitrary shell tokens. No public exploit identified at time of analysis.

Technical ContextAI

The root cause is CWE-116 (Improper Encoding or Escaping of Output). go-git's SSH transport layer constructs a remote exec string of the form 'git-upload-pack '\''<repo-path>'\''' using naïve single-quote wrapping. Canonical Git implements sq_quote_buf, which replaces every embedded single quote with the four-character sequence '\''\'' (close quote, escaped quote, reopen quote), allowing arbitrary paths to round-trip safely as a single shell token. Affected packages identified via PURL are: pkg:go/github.com/go-git/go-git/v5 (all releases through 5.19.0), pkg:go/github.com/go-git/go-git/v6 (all alpha releases through 6.0.0-alpha.3), and pkg:go/github.com/go-git/go-git (the legacy v4 line, all releases through 4.7.0). The vulnerability lives in the bytes go-git places on the wire; any SSH client could technically send the same payload, but go-git is uniquely at risk because repository paths it operates on can be influenced by untrusted sources.

RemediationAI

The primary remediation for v5 users is to upgrade to go-git v5.19.1, and for v6 pre-release users to upgrade to v6.0.0-alpha.4. Both patched versions port sq_quote_buf from canonical Git so that the SSH transport wire output is byte-identical to what git itself produces, closing the injection path. The v4 legacy line (go-git without a version suffix) has no available patch; users on v4 must migrate to the v5 module. For deployments that cannot immediately upgrade, the most effective compensating control is to ensure that every SSH server accepting go-git connections uses git-shell as the forced command rather than a general login shell or a ForceCommand wrapper that re-evaluates $SSH_ORIGINAL_COMMAND - git-shell tokenizes the exec command without shell interpretation and is not vulnerable to this class of injection. Additionally, restrict which repository paths go-git is allowed to operate on so that untrusted input cannot reach the SSH transport layer. Advisory: https://github.com/go-git/go-git/security/advisories/GHSA-m7cr-m3pv-hgrp.

CVE-2011-3544 CRITICAL POC
9.8 Oct 19

Oracle Java SE JDK/JRE 7 and 6 Update 27 and earlier allows remote code execution with complete system compromise throug

CVE-2019-11043 CRITICAL POC
9.8 Oct 28

In PHP versions 7.1.x below 7.1.33, 7.2.x below 7.2.24 and 7.3.x below 7.3.11 in certain configurations of FPM setup it

CVE-2014-6271 CRITICAL POC
9.8 Sep 24

GNU Bash through 4.3 processes trailing strings after function definitions in the values of environment variables, which

CVE-2013-0422 CRITICAL POC
9.8 Jan 10

Multiple vulnerabilities in Oracle Java 7 before Update 11 allow remote attackers to execute arbitrary code by (1) using

CVE-2016-3714 HIGH POC
8.4 May 05

The (1) EPHEMERAL, (2) HTTPS, (3) MVG, (4) MSL, (5) TEXT, (6) SHOW, (7) WIN, and (8) PLT coders in ImageMagick before 6.

CVE-2017-12617 HIGH POC
8.1 Oct 04

When running Apache Tomcat versions 9.0.0.M1 to 9.0.0, 8.5.0 to 8.5.22, 8.0.0.RC1 to 8.0.46 and 7.0.0 to 7.0.81 with HTT

CVE-2016-8735 CRITICAL POC
9.8 Apr 06

Remote code execution is possible with Apache Tomcat before 6.0.48, 7.x before 7.0.73, 8.x before 8.0.39, 8.5.x before 8

CVE-2014-7169 CRITICAL POC
9.8 Sep 25

GNU Bash through 4.3 bash43-025 processes trailing strings after certain malformed function definitions in the values of

CVE-2014-0160 HIGH POC
7.5 Apr 07

The (1) TLS and (2) DTLS implementations in OpenSSL 1.0.1 before 1.0.1g do not properly handle Heartbeat Extension packe

CVE-2016-5195 HIGH POC
7.0 Nov 10

Race condition in mm/gup.c in the Linux kernel 2.x through 4.x before 4.8.3 allows local users to gain privileges by lev

CVE-2013-2423 LOW POC
3.7 Apr 17

Unspecified vulnerability in the Java Runtime Environment (JRE) component in Oracle Java SE 7 Update 17 and earlier, and

CVE-2023-4911 HIGH POC
7.8 Oct 03

Local privilege escalation in the GNU C Library (glibc) dynamic loader ld.so allows unprivileged local users on affected

Share

CVE-2026-45570 vulnerability details – vuln.today

This site uses cookies essential for authentication and security. No tracking or analytics cookies are used. Privacy Policy