Patchfirst
CVE-2018-16873 High · 7.5 EPSS 66.1%

In Go before 1.10.6 and 1.11.x before 1.11.3, the "go get" command is vulnerable to remote code execution when…

Fix:upgrade toolchain to 1.26.11 or later also fixes CVE-2026-97040 Details ↓

[UNKNOWN] · golang

Summary

The Go toolchain's "go get" command, in versions before 1.10.6 and 1.11.x before 1.11.3, mishandles vanity import paths ending in "/.git" in GOPATH mode, allowing a crafted repository layout to make it run Git commands against a parent directory and use a malicious "config" file. An attacker can achieve remote code execution by getting a victim to run "go get -u" on a malicious Go package, or on a package that imports it directly or indirectly, with the attack relying on a custom-domain vanity import path and careful ordering of repository files; module mode is not affected.

Official description · CVE.org

In Go before 1.10.6 and 1.11.x before 1.11.3, the "go get" command is vulnerable to remote code execution when executed with the -u flag and the import path of a malicious Go package, or a package that imports it directly or indirectly. Specifically, it is only vulnerable in GOPATH mode, but not in module mode (the distinction is documented at https://golang.org/cmd/go/#hdr-Module_aware_go_get). Using custom domains, it's possible to arrange things so that a Git repository is cloned to a folder named ".git" by using a vanity import path that ends with "/.git". If the Git repository root contains a "HEAD" file, a "config" file, an "objects" directory, a "refs" directory, with some work to ensure the proper ordering of operations, "go get -u" can be tricked into considering the parent directory as a repository root, and running Git commands on it. That will use the "config" file in the original Git repository root for its configuration, and if that config file contains malicious commands, they will execute on the system running "go get -u".

Breakdown
25.1 / 100
Exploited
Not confirmed
Reports
0
Tactics
0/15

Disclosed on 14 Dec 2018. No public exploit code or confirmed exploitation is recorded.

7 fixes in toolchain over 3 years. The latest fix listed for toolchain is 1.15.5.

Fixes in toolchainGo package, by fixed version. Earlier and later fixes in the same package, not necessarily the same bug.

  1. 1.9.1CVE-2017-150415 Oct 2017
  2. 1.9.4CVE-2018-65747 Feb 2018
  3. 1.10.1CVE-2018-718716 Feb 2018
  4. 1.11.3CVE-2018-1687314 Dec 2018
  5. 1.11.3CVE-2018-1687414 Dec 2018
  6. 1.15.5CVE-2020-2836618 Nov 2020
  7. 1.15.5CVE-2020-2836718 Nov 2020Latest listed

Affected versions and fixes

as published in the CVE record

[UNKNOWN] golang

Affected: 1.10.6 · 1.11.3

Am I affected? What do I upgrade to?

From GitHub Security Advisories and OSV

1 package in 1 ecosystem. Main package: toolchain.

GotoolchainGO-2022-0189

Upgrade to 1.26.11 or later

Fixes this CVE and 1 other known vulnerability in this package (CVE-2026-97040).

Set the version to Go 1.26.11 or later in your Go toolchain.

First fixed in 1.11.3 for CVE-2018-16873.

Affected versions, by release line

If you runUpgrade to
1.11.0-0 up to 1.11.31.26.11first fix for this CVE: 1.11.3
All versions before 1.10.6

Still affected on this line by CVE-2026-97040 (fixed in 1.26.11, a newer line).

1.10.6

“Up to” means the second version is the fix and is not affected.

Check your lockfile against all CVEs

References

12 links, grouped by NVD tag
↑ ↓ chooseEnter openEsc close