CVE-2023-29404: Improper handling of non-optional LDFLAGS in go command with cgo in cmd/go
Golang Go could allow a remote attacker to execute arbitrary code on the system, caused by a flaw when running "go get" on a malicious module. By sending a specially crafted request using linker flags, an attacker could exploit this vulnerability to execute arbitrary code on the system.
Other sources
Improper handling of non-optional LDFLAGS in go command with cgo in cmd/go
— Microsoft
The go command may execute arbitrary code at build time when using cgo. This may occur when running "go get" on a malicious module, or when running any other command which builds untrusted code. This is can by triggered by linker flags, specified via a "#cgo LDFLAGS" directive. The arguments for a number of flags which are non-optional are incorrectly considered optional, allowing disallowed flags to be smuggled through the LDFLAGS sanitization. This affects usage of both the gc and gccgo compilers.
— Launchpad
Affected Software
Remediation
Patch Available
Event History
Frequently Asked Questions
What is CVE-2023-29404?
CVE-2023-29404 is a vulnerability in the go command that allows for the execution of arbitrary code at build time when using cgo.
How does CVE-2023-29404 occur?
CVE-2023-29404 can occur when running 'go get' on a malicious module or any other command that builds untrusted code.
What triggers CVE-2023-29404?
CVE-2023-29404 can be triggered by linker flags specified via a '#cgo LDFLAGS' directive.
Which software versions are affected by CVE-2023-29404?
The affected software versions are Go up to and including 1.19.10, Go between 1.20.0 and 1.20.5, and Fedora 38.
What is the severity of CVE-2023-29404?
CVE-2023-29404 has a severity rating of 9.8 (critical).
What is the CWE classification of CVE-2023-29404?
CVE-2023-29404 is classified as CWE-94 (Code Injection).