CVE-2018-6574
Go before 1.8.7, Go 1.9.x before 1.9.4, and Go 1.10 pre-releases before Go 1.10rc2 allow "go get" remote command execution during source code build, by leveraging the gcc or clang plugin feature, because -fplugin= and -plugin= arguments were not blocked.
02 / AFFECTED SOFTWARE
Affected packages
138 explicit affected versions
03 / CONNECTIONS
Connected vulnerabilities
04 / EVIDENCE
Source records
Go before 1.8.7, Go 1.9.x before 1.9.4, and Go 1.10 pre-releases before Go 1.10rc2 allow "go get" remote command execution during source code build, by leveraging the gcc or clang plugin feature, because -fplugin= and -plugin= arguments were not blocked.
The "go get" command with cgo is vulnerable to remote command execution by leveraging the gcc or clang plugin feature. When cgo is enabled, the build step during "go get" invokes the host C compiler, gcc or clang, adding compiler flags specified in the Go source files. Both gcc and clang support a plugin mechanism in which a shared-library plugin is loaded into the compiler, as directed by compiler flags. This means that a Go package repository can contain an attack.so file along with a Go source file that says (for example) "// #cgo CFLAGS: -fplugin=attack.so" causing the attack plugin to be loaded into the host C compiler during the build. Gcc and clang plugins are completely unrestricted in their access to the host system.
05 / REFERENCES
Further evidence
- https://access.redhat.com/errata/RHSA-2018:0878
- https://access.redhat.com/errata/RHSA-2018:1304
- https://github.com/KINGSABRI/CVE-in-Ruby/tree/master/CVE-2018-6574
- https://github.com/golang/go/issues/23672
- https://groups.google.com/forum/#%21topic/golang-nuts/Gbhh1NxAjMU
- https://groups.google.com/forum/#%21topic/golang-nuts/sprOaQ5m3Dk
- https://www.debian.org/security/2019/dsa-4380
- https://go.dev/issue/23672
- https://go.googlesource.com/go/+/1dcb5836ad2c60776561da2923c70576ba2eefc6
- https://groups.google.com/g/golang-nuts/c/Gbhh1NxAjMU