Improper handling of non-optional LDFLAGS in go command with cgo in cmd/go
CVE-2023-29404
9.8CRITICAL
What is CVE-2023-29404?
A vulnerability exists in the Go command that may allow arbitrary code execution during build time when using cgo. This can occur when running commands like 'go get' on untrusted or malicious modules. The issue arises from the mishandling of linker flags indicated through the '#cgo LDFLAGS' directive. Several non-optional flags are incorrectly treated as optional, which opens the door for disallowed flags to bypass LDFLAGS sanitization, impacting both gc and gccgo compilers.
Affected Version(s)
cmd/go 0 < 1.19.10
cmd/go 1.20.0-0 < 1.20.5