Skip to content
OpenAdvisories
Unscored Public exploit CVE-2023-39320 BIT-golang-2023-39320EUVD-2023-43052GHSA-rxv8-v965-v333GO-2023-2042

Arbitrary code execution via go.mod toolchain directive in cmd/go

Published Sep 8, 2023 · Updated Feb 13, 2025 · Assigned by Go

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 products

VendorProductAffectedFixed
Go toolchain cmd/go 1.21.0-0 – < 1.21.1 1.21.1

Fixed in Linux distributions

Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.

ReleasePackageFixed inAdvisory
SLES 15 SP5 go1.21 1.21.1-150000.1.6.1 SUSE-SU-2023:3701-1
SLES 15 SP5 go1.21-openssl 1.21.4.1-150000.1.5.1 SUSE-SU-2023:4469-1
SLES 15 SP4 go1.21 1.21.1-150000.1.6.1 SUSE-SU-2023:3701-1
SLES 15 SP4 go1.21-openssl 1.21.4.1-150000.1.5.1 SUSE-SU-2023:4469-1
Show 1 more (older releases, extended support, other products)
ReleasePackageFixed inAdvisory
SUSE Package Hub 12 go 1.21-41.1 openSUSE-SU-2023:0360-1
SUSE Package Hub 12 go1.21 1.21.3-2.1 openSUSE-SU-2023:0360-1
ReleasePackageFixed inAdvisory
openSUSE Tumbleweed go1.21 1.21.1-1.1 openSUSE-SU-2024:13217-1
openSUSE Leap 15.5 go1.21 1.21.1-150000.1.6.1 SUSE-SU-2023:3701-1
openSUSE Leap 15.5 go1.21-openssl 1.21.4.1-150000.1.5.1 SUSE-SU-2023:4469-1
openSUSE Leap 15.4 go1.21 1.21.1-150000.1.6.1 SUSE-SU-2023:3701-1
openSUSE Leap 15.4 go1.21-openssl 1.21.4.1-150000.1.5.1 SUSE-SU-2023:4469-1
ReleasePackageFixed inAdvisory
Alpine v3.24 go 1.21.1-r0 —
Alpine v3.23 go 1.21.1-r0 —
Alpine v3.22 go 1.21.1-r0 —
Alpine v3.21 go 1.21.1-r0 —
Alpine v3.20 go 1.21.1-r0 —
Show 1 more (older releases, extended support, other products)
ReleasePackageFixed inAdvisory
Alpine v3.19 go 1.21.1-r0 —

Wolfi

ReleasePackageFixed inAdvisory
Wolfi rolling metrics-server 0.6.4-r1 —

Public exploits

Exploit or proof-of-concept code for this vulnerability is publicly available, which lowers the bar for attackers. Treat it as a reason to patch sooner.

Third-party code, not reviewed by us. Public PoCs are sometimes fake or contain malware. Read the code first and run it only in an isolated lab, against systems you are authorised to test.

GitHub 1 repository

Sources: PoC-in-GitHub, Metasploit Framework, Exploit-DB — updated daily. Only links are listed; no exploit code is hosted here.

Affected packages

EcosystemPackageAffectedFixedRecord
Go toolchain >= 1.21.0-0, < 1.21.1 1.21.1 GO-2023-2042

Advisories 5

References