CVE-2023-29404 Improper handling of non-optional LDFLAGS in go command with cgo in cmd/go
Attackers can execute arbitrary code during build time by exploiting improper LDFLAGS sanitization in the Go command when using cgo.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Over the internet
- Victim action needed
- Not needed
- Fix
- Available
What is CVE-2023-29404?
CVE-2023-29404 is a critical code injection vulnerability in Fedoraproject Fedora, published on 8 Jun 2023. An attacker can exploit it over the internet without logging in, with no action from the victim.
Official description
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.
Weakness: CWE-94
Which versions are affected by CVE-2023-29404?
2 open source packages ship an affected version, including golang and toolchain. It affects 2 products.
| Package | Affected | Fixed in |
|---|---|---|
golang Bitnami | All versions | 1.19.10, 1.20.5 |
toolchain Go | All versions | 1.19.10, 1.20.5 |
Products include Fedoraproject Fedora, Golang Go.
How do I fix CVE-2023-29404?
Upgrade golang to a fixed version for your release line: 1.19.10 or 1.20.5.
Upgrade, and never evaluate templates, expressions or code built from user input. More about Code injection.
Is CVE-2023-29404 being exploited?
There is no known exploitation of CVE-2023-29404 in the wild and no public exploit code.
Other vulnerabilities in Fedoraproject Fedora
Sources
Also known as AZL-27140, AZL-27150, AZL-37337, AZL-37510, AZL-47146, BIT-golang-2023-29404 and 5 more.