CVE-2023-29402 Code injection via go command with cgo in cmd/go

Critical 9.8 Published Updated

Attackers can inject code during build time via cgo if untrusted modules with newline characters in directory names are used in GOPATH mode.

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-29402?

CVE-2023-29402 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 generate unexpected code at build time when using cgo. This may result in unexpected behavior when running a go program which uses cgo. This may occur when running an untrusted module which contains directories with newline characters in their names. Modules which are retrieved using the go command, i.e. via "go get", are not affected (modules retrieved using GOPATH-mode, i.e. GO111MODULE=off, may be affected).

Weakness: CWE-94

Which versions are affected by CVE-2023-29402?

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-29402?

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-29402 being exploited?

There is no known exploitation of CVE-2023-29402 in the wild and no public exploit code.

All Fedoraproject Fedora vulnerabilities

Sources

Also known as AZL-27111, AZL-27122, AZL-37329, AZL-37353, AZL-47225, BIT-golang-2023-29402 and 5 more.

Is CVE-2023-29402 in your software?

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

Check your SBOMs for free