{"id":"CVE-2026-45570","aliases":["CVE-2026-45570","GHSA-m7cr-m3pv-hgrp","GO-2026-5496"],"related":["CGA-4fx8-v7vx-v65m"],"kind":"vulnerability","state":"published","title":"go-git: Improper single-quote escaping in go-git SSH transport","summary":"go-git is an extensible git implementation library written in pure Go. Prior to 5.19.1 and 6.0.0-alpha.4, 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. 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. This vulnerability is fixed in 5.19.1 and 6.0.0-alpha.4.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"go-git is an extensible git implementation library written in pure Go. Prior to 5.19.1 and 6.0.0-alpha.4, 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. 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. This vulnerability is fixed in 5.19.1 and 6.0.0-alpha.4.","source":"cvelist"},{"lang":"en","text":"### Impact\n\n`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.\n\nA 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.\n\nThe 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.\n\n### Patches\n\nUsers 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.\n\nVersions prior to `v5` are likely to be affected, users are recommended to upgrade to a supported go-git version.\n\n### Credit\n\nThanks to @N0zoM1z0 for reporting this to the `go-git` project. :bow:","format":"markdown","source":"ghsa"},{"lang":"en","text":"Improper single-quote escaping in go-git SSH transport in github.com/go-git/go-git","format":"markdown","source":"go"}],"published":"2026-05-19T15:21:01.000Z","modified":"2026-09-10T03:51:06.296Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"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","score":2.3,"rating":"LOW"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:4.0","vector":"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","score":2.3,"rating":"LOW"},{"scorer":"GitHub","scheme":"CVSS:4.0","vector":"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","rating":"LOW"},{"scorer":"NVD","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:C/C:H/I:H/A:H","score":9.6,"rating":"CRITICAL"}],"cwes":["CWE-116"],"affected":[{"ranges":[{"version":"< 5.19.1","status":"affected"},{"version":">= 6.0.0-alpha.1, < 6.0.0-alpha.4","status":"affected"}],"vendor":"go-git","product":"go-git","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"5.19.1"}],"ecosystem":"Go","package":"github.com/go-git/go-git/v5","purl":"pkg:golang/github.com/go-git/go-git/v5","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"6.0.0-alpha.4"}],"ecosystem":"Go","package":"github.com/go-git/go-git/v6","purl":"pkg:golang/github.com/go-git/go-git/v6","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","lastAffected":"4.7.0"}],"ecosystem":"Go","package":"github.com/go-git/go-git","purl":"pkg:golang/github.com/go-git/go-git","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0","status":"affected"}],"ecosystem":"Go","package":"github.com/go-git/go-git","purl":"pkg:golang/github.com/go-git/go-git","source":"go"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"5.19.1"}],"ecosystem":"Go","package":"github.com/go-git/go-git/v5","purl":"pkg:golang/github.com/go-git/go-git/v5","source":"go"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"6.0.0-alpha.4"}],"ecosystem":"Go","package":"github.com/go-git/go-git/v6","purl":"pkg:golang/github.com/go-git/go-git/v6","source":"go"},{"ranges":[{"status":"affected","fixed":"5.19.1"},{"status":"affected","version":"6.0.0"},{"status":"affected","version":"6.0.0"},{"status":"affected","version":"6.0.0"}],"vendor":"go-git_project","product":"go-git","cpe":"cpe:2.3:a:go-git_project:go-git:*:*:*:*:*:go:*:*","source":"nvd"}],"references":[{"url":"https://github.com/go-git/go-git/security/advisories/GHSA-m7cr-m3pv-hgrp","tags":["advisory","vendor-advisory","web","x-refsource-confirm"],"sources":["cvelist","ghsa","go","nvd"]},{"url":"https://nvd.nist.gov/vuln/detail/CVE-2026-45570","tags":["advisory"],"sources":["ghsa"]},{"url":"https://github.com/go-git/go-git","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"none","automatable":"no","technicalImpact":"partial","date":"2026-05-28T15:11:53.826Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-45570","url":"https://www.cve.org/CVERecord?id=CVE-2026-45570","licence":"CVE Terms of Use","modified":"2026-05-28T15:12:03.134Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-m7cr-m3pv-hgrp","url":"https://github.com/advisories/GHSA-m7cr-m3pv-hgrp","licence":"CC-BY-4.0","modified":"2026-09-10T03:51:06.296Z"},{"source":"go","name":"Go Vulnerability Database","id":"GO-2026-5496","url":"https://pkg.go.dev/vuln/GO-2026-5496","licence":"CC-BY-4.0","modified":"2026-07-10T05:44:31.197Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-45570","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-45570","licence":"Public domain","modified":"2026-06-17T10:52:13.177Z"}],"updatedAt":"2026-11-25T22:59:22.597Z","epss":{"score":0.00365,"percentile":0.32416,"date":"2026-12-01T12:00:22.000Z"}}