Severity by source
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
Lifecycle Timeline
3DescriptionGitHub 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.
Oracle Java SE JDK/JRE 7 and 6 Update 27 and earlier allows remote code execution with complete system compromise throug
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
GNU Bash through 4.3 processes trailing strings after function definitions in the values of environment variables, which
Multiple vulnerabilities in Oracle Java 7 before Update 11 allow remote attackers to execute arbitrary code by (1) using
The (1) EPHEMERAL, (2) HTTPS, (3) MVG, (4) MSL, (5) TEXT, (6) SHOW, (7) WIN, and (8) PLT coders in ImageMagick before 6.
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
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
GNU Bash through 4.3 bash43-025 processes trailing strings after certain malformed function definitions in the values of
The (1) TLS and (2) DTLS implementations in OpenSSL 1.0.1 before 1.0.1g do not properly handle Heartbeat Extension packe
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
Unspecified vulnerability in the Java Runtime Environment (JRE) component in Oracle Java SE 7 Update 17 and earlier, and
Local privilege escalation in the GNU C Library (glibc) dynamic loader ld.so allows unprivileged local users on affected
Same weakness CWE-116 – Improper Encoding or Escaping of Output
View allSame technique Information Disclosure
View allShare
External POC / Exploit Code
Leaving vuln.today
EUVD-2026-32546
GHSA-m7cr-m3pv-hgrp