CVE-2023-29404 Improper handling of non-optional LDFLAGS in go command with cgo in cmd/go

Critical 9.8 Published Updated

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.

PackageAffectedFixed in
golang BitnamiAll versions1.19.10, 1.20.5
toolchain GoAll versions1.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.

All Fedoraproject Fedora vulnerabilities

Sources

Also known as AZL-27140, AZL-27150, AZL-37337, AZL-37510, AZL-47146, BIT-golang-2023-29404 and 5 more.

Is CVE-2023-29404 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free