CVE-2023-29405
golang: cmd/cgo: Arbitrary code execution triggered by linker flags
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. Flags containing embedded spaces are mishandled, allowing disallowed flags to be smuggled through the LDFLAGS sanitization by including them in the argument of another flag. This only affects usage of the gccgo compiler.
Statement
This vulnerability is only applicable to customer use of the 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-74 · Improper Neutralization of Special Elements in Output Used by a Downstream Component ('Injection')