Attack ChainAIDerived
Hypothetical attack flow derived from CVE metadata – not a confirmed exploit chain
-
AccessSupply crafted repo path with embedded single quote
-
Deliverygo-git SSH transport wraps path in unescaped single quotes
-
ExploitSSH exec string sent to server with injected shell tokens
-
ExecutionServer evaluates exec via /bin/sh or /bin/bash
-
PersistInjected tokens execute in git service account context
-
ImpactArbitrary command execution achieved
Vulnerability Assessment
| Weakness |
CWE
OWASP Top 10:2025
A05:2025 - Injection
ASVS 5.0
V1 - Encoding and Sanitization Output encoding for downstream
|
| Exploitation Conditions | Exploitation requires two simultaneous conditions. First, the attacker must control or influence the repository path value passed into go-git's SSH transport - for example through a user-supplied clone URL, a server-side redirect, or a configuration value sourced from untrusted input. Second, the SSH server receiving the connection must evaluate the exec command through a Unix shell (e.g., the git service account's login shell is /bin/sh or /bin/bash, or a ForceCommand directive passes $SSH_ORIGINAL_COMMAND to a shell for further evaluation). Exploitation is NOT possible against SSH servers that use git-shell, which tokenizes the exec command without shell evaluation. Standard hosted Git platforms (GitHub, GitLab, Gitea in default configuration) are therefore not affected. Authentication requirements cannot be confirmed from available data because no CVSS vector is provided; the requirement to authenticate to the SSH server before the exec command is evaluated likely limits unauthenticated exploitation, but this is inferred, not confirmed. |
| Impact | No CVSS vector or EPSS data is present in the available intelligence, preventing quantitative scoring. Risk must therefore be assessed qualitatively. The advisory tags include 'Information Disclosure' but the described impact is arbitrary shell command execution in the SSH server's command context - a materially higher severity than that tag suggests; confirm with vendor whether the tag is accurate or understated. Exploitation is gated by two conditions that significantly limit the real-world attack surface: (1) the attacker must be able to influence the repository path passed to go-git, and (2) the target SSH server must evaluate the exec command through a shell rather than tokenizing it directly. Standard git-shell deployments are explicitly NOT affected, which covers the majority of hosted Git services. Self-hosted setups with user accounts whose login shell is /bin/sh or /bin/bash, or custom ForceCommand wrappers that re-evaluate $SSH_ORIGINAL_COMMAND, represent the realistic risk population. No CISA KEV listing, no POC, and no EPSS score exist at time of analysis; risk priority should be determined by whether the deploying organization runs shell-evaluating SSH configurations for git access. |
| Exploit ScenarioDerived | An attacker who can supply or manipulate a repository URL processed by a go-git-based application crafts a path such as foo'$(id>/tmp/pwned)' - the embedded single quote terminates the shell's quoted region and the parenthesized command runs when the SSH server evaluates the exec string through /bin/bash. This scenario requires the target infrastructure to use a user account with a general login shell for SSH git access rather than the hardened git-shell configuration. No public proof-of-concept code has been identified at time of analysis. |
Get an e-mail when this CVE is exploited, patched or re-scored. Free account.
Alert meAnalysisAIv1 – May 19, 2026
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.
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.
Affected VersionsENISA
Affected Packages
Source: OSV (Open Source Vulnerabilities)
Affects your stack
Affects 5 packages in go, euvd
Checking this CVE against your own stacks and servers is part of the Basic plan and up.
Technical ContextAI · show details
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.
Know when Canonical gets its next vulnerability
- Watch products and get an email when something new is published
- Check this CVE against your own stack and servers
- Exploit and PoC references, threat intelligence from 22 sources
No credit card · 7-day full trial
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
Primary rating from GitHub Advisory · only source for this CVE.
CVSS VectorGitHub Advisory
Lifecycle Timeline
1DescriptionGitHub 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:
Threat Intelligence Overview
How this decision was reached
The engine reads each signal below and applies a fixed list of rules from top to bottom. The first rule that matches sets the recommended action – like a statement, every line is shown.
What every action level means
SSVC AssessmentENISA
Priority Score
Attack Technique
Information disclosure occurs when an application unintentionally exposes sensitive data that aids attackers in reconnaissance or directly compromises security.
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
EUVD-2026-32546
GHSA-m7cr-m3pv-hgrp
NVD
CVE.org
EPSS
VulDB
Exploit-DB