CVE-2023-29404
golang: cmd/go: go command may execute arbitrary code at build time when using cgo
Severity
ImportantRed Hat Product Security
CVSS 3.1
Review impact separately from score.
Published · June 8, 2023
Updated · February 26, 2026
Description
A flaw was found in golang. The go command may execute arbitrary code at build time when using cgo. This can occur when running "go get" on a malicious module, or when running any other command which builds untrusted code. This can be 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.
Statement
This vulnerability is only applicable to customer use of the GC & GCCGO compiler and not any pre-compiled golang binaries shipped by Red Hat.
CVSS score applicability
The CVSS score(s) listed for this vulnerability do not reflect the associated product's status, and are included for informational purposes to better understand the severity of this vulnerability.
Mitigation
No mitigation is specified in collected source.
CVSS / CWE
CVSS 3.1 · 7.5CVSS:3.1/AV:N/AC:H/PR:N/UI:R/S:U/C:H/I:H/A:H
CWE-94 · Improper Control of Generation of Code ('Code Injection')