CVE-2023-29405 Improper sanitization of LDFLAGS with embedded spaces in go command with cgo in cmd/go
Attackers can execute arbitrary code during build time via malicious linker flags in Go modules using gccgo.
- 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-29405?
CVE-2023-29405 is a critical command 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. 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.
Weakness: CWE-74
Which versions are affected by CVE-2023-29405?
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-29405?
Upgrade golang to a fixed version for your release line: 1.19.10 or 1.20.5.
Upgrade, and pass arguments to programs as a list instead of through a shell. More about Command injection.
Is CVE-2023-29405 being exploited?
There is no known exploitation of CVE-2023-29405 in the wild and no public exploit code.
Other vulnerabilities in Fedoraproject Fedora
Sources
Also known as AZL-27110, AZL-27123, AZL-37347, AZL-37499, AZL-52827, AZL-79012 and 7 more.