CVE-2026-45570: go-git command injection in SSH transport via improper path escaping

CVE-2026-45570 · Severity: medium · CVSS 4 · Published 2026-05-27

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.

Technologies: github.com/go-git/go-git (Go), github.com/go-git/go-git/v5 (Go), github.com/go-git/go-git/v6 (Go), Go-Git. Vendors: Go, Go-Git.

Quick answers

Is CVE-2026-45570 exploited in the wild?
No. Junglewise Threat Intelligence has no report of CVE-2026-45570 being exploited in the wild.
How severe is CVE-2026-45570?
Medium severity, with a CVSS score of 4, published 27 May 2026.
Which products and versions are affected?
github.com/go-git/go-git (Go) <= 4.7.0, SEMVER:introduced=0, SEMVER:introduced=0,last_affected=4.7.0; github.com/go-git/go-git/v5 (Go) <= 5.19.0, SEMVER:introduced=0,fixed=5.19.1; github.com/go-git/go-git/v6 (Go) <= 6.0.0-alpha.3, SEMVER:introduced=0,fixed=6.0.0-alpha.4; Go-Git <= 5.19.0.
Is there a fix for CVE-2026-45570?
Yes. github.com/go-git/go-git/v5 (Go): upgrade to 5.19.1 or later; github.com/go-git/go-git/v6 (Go): upgrade to 6.0.0-alpha.4 or later. Junglewise finds every place you run it, drafts the upgrade and applies it once you approve.
How is CVE-2026-45570 attacked?
It is attacked over the network, in a software library.
Am I affected by CVE-2026-45570?
Check whether you run github.com/go-git/go-git (Go), github.com/go-git/go-git/v5 (Go), github.com/go-git/go-git/v6 (Go) or one of the others listed at an affected version. Junglewise does that check for you around the clock: connect your code, cloud and domains, and it matches new vulnerabilities like this one against what you actually run and tells you when one reaches you.

How to fix

  • github.com/go-git/go-git/v5 (Go): upgrade to 5.19.1 or later
    go get github.com/go-git/go-git/v5@v5.19.1
  • github.com/go-git/go-git/v6 (Go): upgrade to 6.0.0-alpha.4 or later
    go get github.com/go-git/go-git/v6@v6.0.0-alpha.4

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

Identifiers

  • CVE-2026-45570
  • GHSA-m7cr-m3pv-hgrp
  • GO-2026-5496

Timeline

  • 2026-05-18: advisory: GitHub Security Advisory published
  • 2026-05-27: disclosed: CVE published to NVD

References

This page as Markdown. Free to reuse under CC BY 4.0 with a link back.