CVE-2026-45570
ADVISORY - githubSummary
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:
Common Weakness Enumeration (CWE)
Improper Encoding or Escaping of Output
GitHub
-
CVSS SCORE
2.3lowChainguard
CGA-4fx8-v7vx-v65m
-
minimos
MINI-24hr-44fm-q245
-
minimos
MINI-3c9f-6qfc-rv55
-
minimos
MINI-556w-fwqq-24f9
-
minimos
MINI-5cr7-8888-2v2f
-
minimos
MINI-5pfc-3xvm-2xrc
-
minimos
MINI-6fgr-4qp8-6hf4
-
minimos
MINI-7539-9799-rhv7
-
minimos
MINI-77mp-6gvw-vw9g
-
minimos
MINI-7ffv-qx98-ggpj
-
minimos
MINI-8phx-qvpf-f84c
-
minimos
MINI-9v3h-vpx2-5p5r
-
minimos
MINI-c8p3-rwr7-c2q7
-
minimos
MINI-cc7c-m4rw-5v28
-
minimos
MINI-fm2r-mxhh-x63q
-
minimos
MINI-g5m6-gmf3-gw3v
-
minimos
MINI-h2mw-pv59-j438
-
minimos
MINI-hr5h-p6x7-rfrf
-
minimos
MINI-hvvg-x9wc-9m3v
-
minimos
MINI-mhxm-j472-pqv5
-
minimos
MINI-pg44-9whw-389f
-
minimos
MINI-q84x-5mxh-3vj2
-
minimos
MINI-qqc7-pj8x-fxqc
-
minimos
MINI-qvqf-8c7c-4vc4
-
minimos
MINI-rgpq-ccw3-wjh2
-
minimos
MINI-rq4q-vhg7-52cp
-
minimos
MINI-x57m-54r9-6465
-
minimos
MINI-xg98-mf38-369w
-
minimos
MINI-xm34-5hp2-5f37
-
minimos
MINI-xp2c-hhp4-rv7c
-