Executive brief
go-git is a software library used by developers to integrate Git functionality into Go applications. A security flaw in how the library handles SSH connections could allow a specially crafted repository path to execute unintended commands on certain server configurations. This could lead to unauthorized command execution or minor data manipulation on servers that use a shell to process Git commands.
Technical details
The vulnerability exists in go-git's SSH transport implementation due to improper neutralisation of special elements within a repository path (CWE-116). When constructing the remote execution command, the library wraps the path in single quotes but fails to escape single quotes already present in the path string. An attacker can provide a repository path containing a single quote to break out of the quoted string and append arbitrary shell tokens. This is exploitable against SSH servers that evaluate the execution command through a shell (e.g., /bin/bash or ForceCommand wrappers). Servers using git-shell or those that tokenize commands without shell evaluation are not affected. The fix implements proper shell-quoting parity with canonical Git.
Affected products
- go-git go-git/v5 <= 5.19.0
- go-git go-git/v6 <= 6.0.0-alpha.3
Timeline
- 2026-05-18: advisory: GitHub Security Advisory published
- 2026-05-27: disclosed: CVE published to NVD