CVE-2020-28367: Arbitrary code execution via the go command with cgo in cmd/go
An input validation vulnerability was found in Go. If cgo is specified in a Go file, it is possible to bypass the validation of arguments to the gcc compiler. This flaw allows an attacker to create a malicious repository that can execute arbitrary code when downloaded and run via go get or go build while building a Go project. The highest threat from this vulnerability is to confidentiality and integrity as well as system availability.
Other sources
Code injection in the go command with cgo before Go 1.14.12 and Go 1.15.5 allows arbitrary code execution at build time via malicious gcc flags specified via a #cgo directive.
Golang Go could allow a remote attacker to execute arbitrary code on the system, caused by a argument injection flaw in go command when cgo is in use in build time. By using a specially-crafted package, an attacker could exploit this vulnerability to execute arbitrary code on the system.
— IBM
The go command may execute arbitrary code at build time when cgo is in use. This may occur when running go get on a malicious package, or any other command that builds untrusted code. This can be caused by a malicious gcc flags specified via a #cgo directive.
References: https://groups.google.com/g/golang-announce/c/NpBGTTmKzpM/m/fLguyiM2CAAJ https://github.com/golang/go/issues/42556
— Red Hat
Affected Software
Remediation
Patch Available
Information
Event History
Parent advisories
This vulnerability appears in the following advisories.
Frequently Asked Questions
What is CVE-2020-28367?
CVE-2020-28367 is a code injection vulnerability in the go command with cgo before Go 1.14.12 and Go 1.15.5 that allows arbitrary code execution.
How does CVE-2020-28367 impact Go?
CVE-2020-28367 allows an attacker to create a malicious repository that can execute arbitrary code when downloaded and run via `go get` or `go build`.
What is the severity of CVE-2020-28367?
CVE-2020-28367 has a severity rating of high (7 out of 10).
Which versions of Go are affected by CVE-2020-28367?
CVE-2020-28367 affects Go versions before Go 1.14.12 and Go 1.15.5.
How can I mitigate the risk of CVE-2020-28367?
To mitigate the risk of CVE-2020-28367, it is recommended to update to Go 1.14.12 or Go 1.15.5.