CVE-2018-16873
mediumpriority · attend · 55EPSS 0.663 · 99 %ileEURUUSEPSS · scored 2026-10-27
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".
cvss
Technical severity, 0–10. One row per scoring source.
base score 0–10 · higher = more severe · hover a vector to decode⚠ sources disagree · medium–high · 6.8–8.1
weaknesses
The CWE weakness classes this flaw belongs to.
affected products (17)
Products and version ranges known to be affected.
advisories (1)
Vendor and ecosystem advisories describing this.
- GO-2022-0189Remote command execution via "go get" with "-u" flag in cmd/go2022-08-04vendor · osvUS
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". Note that forbidding import paths with a .git element might not be sufficient to mitigate this issue, as on certain systems there can be other aliases for VCS state folders.
also known as (4)
Other names and identifiers for this entity.
sources
Which sources assert this record, and when.
references (53)
External citations — patches, advisories, analysis.
- http://lists.opensuse.org/opensuse-security-announce/2019-03/msg00044.htmlcnnvd
- http://lists.opensuse.org/opensuse-security-announce/2019-05/msg00060.htmlcnnvd
- http://lists.opensuse.org/opensuse-security-announce/2019-06/msg00011.htmlcnnvd
- http://lists.opensuse.org/opensuse-security-announce/2019-06/msg00015.htmlcnnvd
- http://lists.opensuse.org/opensuse-security-announce/2019-07/msg00010.htmlcnnvd
- http://lists.opensuse.org/opensuse-security-announce/2020-04/msg00041.htmlcnnvd
- http://www.securityfocus.com/bid/106226cnnvd
- https://bugzilla.redhat.com/show_bug.cgi?id=CVE-2018-16873cnnvd
Attackers weaponise vulnerabilities like this against internet-exposed services. See what is exposed on your perimeter with a free passive scan.
Free scan