Vulnerability · Published Sep 8, 2023 · Assigned by Go

CVE-2023-39320Arbitrary code execution via go.mod toolchain directive in cmd/go

Critical 9.8

In plain English

A critical-severity security flaw in cmd/go 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.8% (higher than 78% of all known vulnerabilities). Ready-made attack tooling exists: public proof-of-concept code. Fixed versions are available - upgrade the affected package.

Severity (CVSS NVD)9.8Critical
Exploit odds (30 days)1.8%top 21.9% of all CVEs
Exploited in the wildNo reportsCISA SSVC: none
Attack tooling1Public PoC

Official description

The go.mod toolchain directive, introduced in Go 1.21, can be leveraged to execute scripts and binaries relative to the root of the module when the "go" command was executed within the module. This applies to modules downloaded using the "go" command from the module proxy, as well as modules downloaded directly using VCS software.

Affected packages & fixed versions

EcosystemPackageFixed inAdvisory
Alpine:v3.20go1.21.1-r0ALPINE-CVE-2023-39320
Alpine:v3.21go1.21.1-r0ALPINE-CVE-2023-39320
Alpine:v3.22go1.21.1-r0ALPINE-CVE-2023-39320
Alpine:v3.23go1.21.1-r0ALPINE-CVE-2023-39320
Alpine:v3.24go1.21.1-r0ALPINE-CVE-2023-39320
Gotoolchain1.21.1GO-2023-2042
Ubuntu:22.04:LTSgolang-1.211.21.1-1~ubuntu22.04.1UBUNTU-CVE-2023-39320
Ubuntu:24.04:LTSgolang-1.211.21.5-1UBUNTU-CVE-2023-39320

Affected products (as reported)

VendorProductVersions
Go toolchain cmd/go 1.21.0-0 – before 1.21.1

References