Vulnerability · Published Jun 8, 2023 · Assigned by Go

CVE-2023-29405Improper sanitization of LDFLAGS with embedded spaces in go command with cgo in cmd/go

Critical 9.8

In plain English

A critical-severity security flaw in cmd/cgo from Go toolchain. There are no confirmed reports of exploitation so far. The chance it is exploited in the next 30 days is estimated at 1.7% (higher than 77% of all known vulnerabilities). Fixed versions are available - upgrade the affected package.

Severity (CVSS 3.1)9.8Critical
Exploit odds (30 days)1.7%top 22.5% of all CVEs
Exploited in the wildNo reportsCISA SSVC: none
Attack toolingNoneno public tooling known

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.

Affected packages & fixed versions

EcosystemPackageFixed inAdvisory
AlmaLinux:8delve1.9.1-1.module_el8.8.0+3471+a62632a0ALSA-2023:3922
AlmaLinux:8go-toolset1.19.10-1.module_el8.8.0+3571+89db2ae0ALSA-2023:3922
AlmaLinux:9go-toolset1.19.10-1.el9_2ALSA-2023:3923
AlmaLinux:8golang1.19.10-1.module_el8.8.0+3571+89db2ae0ALSA-2023:3922
AlmaLinux:9golang1.19.10-1.el9_2ALSA-2023:3923
AlmaLinux:8golang-bin1.19.10-1.module_el8.8.0+3571+89db2ae0ALSA-2023:3922
AlmaLinux:9golang-bin1.19.10-1.el9_2ALSA-2023:3923
AlmaLinux:8golang-docs1.19.10-1.module_el8.8.0+3571+89db2ae0ALSA-2023:3922
AlmaLinux:9golang-docs1.19.10-1.el9_2ALSA-2023:3923
AlmaLinux:8golang-misc1.19.10-1.module_el8.8.0+3571+89db2ae0ALSA-2023:3922
AlmaLinux:9golang-misc1.19.10-1.el9_2ALSA-2023:3923
AlmaLinux:8golang-race1.19.10-1.module_el8.8.0+3571+89db2ae0ALSA-2023:3922
AlmaLinux:9golang-race1.19.10-1.el9_2ALSA-2023:3923
AlmaLinux:8golang-src1.19.10-1.module_el8.8.0+3571+89db2ae0ALSA-2023:3922
AlmaLinux:9golang-src1.19.10-1.el9_2ALSA-2023:3923
AlmaLinux:8golang-tests1.19.10-1.module_el8.8.0+3571+89db2ae0ALSA-2023:3922
AlmaLinux:9golang-tests1.19.10-1.el9_2ALSA-2023:3923
Alpine:v3.20go1.20.5-r0ALPINE-CVE-2023-29405
Alpine:v3.21go1.20.5-r0ALPINE-CVE-2023-29405
Alpine:v3.22go1.20.5-r0ALPINE-CVE-2023-29405
Alpine:v3.23go1.20.5-r0ALPINE-CVE-2023-29405
Alpine:v3.24go1.20.5-r0ALPINE-CVE-2023-29405
Debian:12golang-1.19no fix listedDEBIAN-CVE-2023-29405
Gotoolchain1.19.10, 1.20.5GO-2023-1842
Rocky Linux:9go-toolset0:1.19.10-1.el9_2RLSA-2023:3923
Rocky Linux:9golang0:1.19.10-1.el9_2RLSA-2023:3923
Ubuntu:22.04:LTSgolang-1.171.17.13-3ubuntu1.2USN-7061-1
Ubuntu:22.04:LTSgolang-1.171.17.13-3ubuntu1.2UBUNTU-CVE-2023-29405
Ubuntu:22.04:LTSgolang-1.181.18.1-1ubuntu1.2USN-7109-1
Ubuntu:22.04:LTSgolang-1.181.18.1-1ubuntu1.2UBUNTU-CVE-2023-29405
Ubuntu:22.04:LTSgolang-1.20no fix listedUBUNTU-CVE-2023-29405

Affected products (as reported)

VendorProductVersions
Go toolchain cmd/go 0 – before 1.19.101.20.0-0 – before 1.20.5
Go toolchain cmd/cgo 0 – before 1.19.101.20.0-0 – before 1.20.5

References