CVE-2023-39320
Arbitrary code execution via go.mod toolchain directive in cmd/go
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.
Attack profile
How easy it is to exploit
- Attack vector
- Network
- Complexity
- Low
- Privileges needed
- None
- User interaction
- None
What an attacker can affect
- Confidentiality
- High
- Integrity
- High
- Availability
- High
Exploit likelihood
What each source reports
NVD Score used
9.8
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.
- Record
CVE-2023-39320- CVSS 3.1
- 9.8 Critical
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H - Weakness
- CWE-94
- Updated
- 2026-11-02
CVE List No score
Arbitrary code execution via go.mod toolchain directive in cmd/go
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.
- Record
CVE-2023-39320- Updated
- 2026-11-02
EUVDEUVD-2023-43052
0.0
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.
- Record
EUVD-2023-43052- CVSS
- 0.0 None
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H - Updated
- 2026-11-03
GitHub AdvisoriesGHSA-rxv8-v965-v333
9.8
The go.mod toolchain directive, introduced in Go 1.21, can be leveraged to execute scripts and...
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.
- Record
GHSA-rxv8-v965-v333- CVSS 3.1
- 9.8 Critical
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H - Weakness
- CWE-94
- Updated
- 2026-11-02
OSVALPINE-CVE-2023-39320
9.8
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.
- Record
ALPINE-CVE-2023-39320- CVSS 3.1
- 9.8 Critical
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H - Updated
- 2026-11-03
OSVBELL-CVE-2023-39320
9.8
- Record
BELL-CVE-2023-39320- CVSS 3.1
- 9.8 Critical
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H - Updated
- 2026-11-02
Show 8 moreShow less
OSVUBUNTU-CVE-2023-39320
9.8
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.
- Record
UBUNTU-CVE-2023-39320- CVSS 3.1
- 9.8 Critical
CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H - Updated
- 2026-11-02
OSVBIT-golang-2023-39320 No score
Arbitrary code execution via go.mod toolchain directive in cmd/go
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.
- Record
BIT-golang-2023-39320- Updated
- 2026-11-02
OSV No score
Arbitrary code execution via go.mod toolchain directive in cmd/go
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.
- Record
CVE-2023-39320- Updated
- 2026-11-02
OSVGO-2023-2042 No score
Arbitrary code execution via go.mod toolchain directive in cmd/go
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.
- Record
GO-2023-2042- Updated
- 2026-11-02
OSVopenSUSE-SU-2023:0360-1 No score
Security update for go1.21
This update introduces go1.21, including fixes for the following issues:
-
go1.21.3 (released 2023-10-10) includes a security fix to the net/http package. Refs boo#1212475 go1.21 release tracking CVE-2023-39325 CVE-2023-44487
- go#63427 go#63417 boo#1216109 security: fix CVE-2023-39325 CVE-2023-44487 net/http: rapid stream resets can cause excessive work
-
go1.21.2 (released 2023-10-05) includes one security fixes to the cmd/go package, as well as bug fixes to the compiler, the go command, the linker, the runtime, and the runtime/metrics package. Refs boo#1212475 go1.21 release tracking CVE-2023-39323
- go#63214 go#63211 boo#1215985 security: fix CVE-2023-39323 cmd/go: line directives allows arbitrary execution during build
- go#62464 runtime: 'traceback did not unwind completely'
- go#62478 runtime/metrics: /gc/scan* metrics return zero
- go#62505 plugin: variable not initialized properly
- go#62506 cmd/compile: internal compiler error: InvertFlags should never make it to codegen v100 = InvertFlags v123
- go#62509 runtime: scheduler change causes Delve's function call injection to fail intermittently
- go#62537 runtime: 'fatal: morestack on g0' with PGO enabled on arm64
- go#62598 cmd/link: issues with Apple's new linker in Xcode 15 beta
- go#62668 cmd/compile: slow to compile 17,000 line switch statement?
- go#62711 cmd/go: TestScript/gotoolchain_path fails if golang.org/dl/go1.21.1 is installed in the user's $PATH
-
go1.21.1 (released 2023-09-06) includes four security fixes to the cmd/go, crypto/tls, and html/template packages, as well as bug fixes to the compiler, the go command, the linker, the runtime, and the context, crypto/tls, encoding/gob, encoding/xml, go/types, net/http, os, and path/filepath packages. Refs boo#1212475 go1.21 release tracking CVE-2023-39318 CVE-2023-39319 CVE-2023-39320 CVE-2023-39321 CVE-2023-39322
- go#62290 go#62266 boo#1215087 security: fix CVE-2023-39321 CVE-2023-39322 crypto/tls: panic when processing partial post-handshake message in QUICConn.HandleData
- go#62394 go#62198 boo#1215086 security: fix CVE-2023-39320 cmd/go: go.mod toolchain directive allows arbitrary execution
- go#62396 go#62196 boo#1215084 security: fix CVE-2023-39318 html/template: improper handling of HTML-like comments within script contexts
- go#62398 go#62197 boo#1215085 security: fix CVE-2023-39319 html/template: improper handling of special tags within script contexts
- go#61743 go/types: interface.Complete panics for interfaces with duplicate methods
- go#61781 cmd/compile: internal compiler error: 'f': value .autotmp_1 (nil) incorrectly live at entry
- go#61818 cmd/go: panic: runtime error: index out of range [-1] in collectDepsErrors
- go#61821 runtime/internal/wasitest: TestTCPEcho is racy
- go#61868 path/filepath: Clean on some invalid Windows paths can lose .. components
- go#61904 net/http: go 1.20.6 host validation breaks setting Host to a unix socket address
- go#61905 cmd/go: go get/mod tidy panics with internal error: net token acquired but not released
- go#61909 cmd/compile: internal compiler error: missed typecheck
- go#61910 os: ReadDir fails on file systems without File ID support on Windows
- go#61927 cmd/distpack: release archives don't include directory members
- go#61930 spec, go/types, types2: restore Go 1.20 unification when compiling for Go 1.20
- go#61932 go/types, types2: index out of range panic in Checker.arguments
- go#61958 cmd/compile: write barrier code is sometimes preemptible when compiled with -N
- go#61959 go/types, types2: panic: infinite recursion in unification with go1.21.0
- go#61964 os: ReadDir(\.\pipe) fails with go1.21 on Windows
- go#61967 crypto/tls: add GODEBUG to control max RSA key size
- go#61987 runtime: simple programs crash on linux/386 with go1.21 when build with -gcflags='all=-N -l'
- go#62019 runtime: execution halts with goroutines stuck in runtime.gopark…
- Record
openSUSE-SU-2023:0360-1- Updated
- 2026-11-02
OSVopenSUSE-SU-2024:13217-1 No score
go1.21-1.21.1-1.1 on GA media
These are all security issues fixed in the go1.21-1.21.1-1.1 package on the GA media of openSUSE Tumbleweed.
- Record
openSUSE-SU-2024:13217-1- Updated
- 2026-11-02
OSVSUSE-SU-2023:3701-1 No score
Security update for go1.21
This update for go1.21 fixes the following issues:
Update to go1.21.1 (bsc#1212475).
- CVE-2023-39318: Fixed improper handling of HTML-like comments within script contexts in html/template (bsc#1215084).
- CVE-2023-39319: Fixed improper handling of special tags within script contexts in html/template (bsc#1215085).
- CVE-2023-39320: Fixed arbitrary execution in go.mod toolchain directive (bsc#1215086).
- CVE-2023-39321, CVE-2023-39322: Fixed a panic when processing post-handshake message on QUIC connections in crypto/tls (bsc#1215087).
The following non-security bug was fixed:
- Add missing directory pprof html asset directory to package (bsc#1215090).
- Record
SUSE-SU-2023:3701-1- Updated
- 2026-11-02
OSVSUSE-SU-2023:4469-1 No score
Security update for go1.21-openssl
This update for go1.21-openssl fixes the following issues:
Update to version 1.21.4.1 cut from the go1.21-openssl-fips branch at the revision tagged go1.21.4-1-openssl-fips.
- Update to go1.21.4
go1.21.4 (released 2023-11-07) includes security fixes to the path/filepath package, as well as bug fixes to the linker, the runtime, the compiler, and the go/types, net/http, and runtime/cgo packages.
- security: fix CVE-2023-45283 CVE-2023-45284 path/filepath: insecure parsing of Windows paths (bsc#1216943, bsc#1216944)
- spec: update unification rules
- cmd/compile: internal compiler error: expected struct value to have type struct
- cmd/link: split text sections for arm 32-bit
- runtime: MADV_COLLAPSE causes production performance issues on Linux
- go/types, x/tools/go/ssa: panic: type param without replacement encountered
- cmd/compile: -buildmode=c-archive produces code not suitable for use in a shared object on arm64
- net/http: http2 page fails on firefox/safari if pushing resources
Initial package go1.21-openssl version 1.21.3.1 cut from the go1.21-openssl-fips branch at the revision tagged go1.21.3-1-openssl-fips. (jsc#SLE-18320)
- Go upstream merged branch dev.boringcrypto in go1.19+.
- In go1.x enable BoringCrypto via GOEXPERIMENT=boringcrypto.
- In go1.x-openssl enable FIPS mode (or boring mode as the package is named) either via an environment variable GOLANG_FIPS=1 or by virtue of booting the host in FIPS mode.
- When the operating system is operating in FIPS mode, Go applications which import crypto/tls/fipsonly limit operations to the FIPS ciphersuite.
- go1.x-openssl is delivered as two large patches to go1.x applying necessary modifications from the golang-fips/go GitHub project for the Go crypto library to use OpenSSL as the external cryptographic library in a FIPS compliant way.
- go1.x-openssl modifies the crypto/* packages to use OpenSSL for cryptographic operations.
- go1.x-openssl uses dlopen() to call into OpenSSL.
- SUSE RPM packaging introduces a fourth version digit go1.x.y.z corresponding to the golang-fips/go patchset tagged revision.
- Patchset improvements can be updated independently of upstream Go maintenance releases.
- Record
SUSE-SU-2023:4469-1- Updated
- 2026-11-02
Affected products
Affected packages
| Package | Affected | Fixed |
|---|---|---|
goAlpine:v3.19 |
1.21.0 up to 1.21.1-r0 | 1.21.1-r0 |
goAlpine:v3.20 |
1.21.0 up to 1.21.1-r0 | 1.21.1-r0 |
goAlpine:v3.21 |
1.21.0 up to 1.21.1-r0 | 1.21.1-r0 |
goAlpine:v3.22 |
1.21.0 up to 1.21.1-r0 | 1.21.1-r0 |
goAlpine:v3.23 |
1.21.0 up to 1.21.1-r0 | 1.21.1-r0 |
goAlpine:v3.24 |
1.21.0 up to 1.21.1-r0 | 1.21.1-r0 |
goAlpaquita:23 |
1.19.7-r0 up to 1.21.7-r0 | 1.21.7-r0 |
goBellSoft Hardened Containers:23 |
1.19.7-r0 up to 1.21.7-r0 | 1.21.7-r0 |
golangBitnami |
1.21.0 up to 1.21.1 | 1.21.1 |
toolchainGo |
1.21.0-0 up to 1.21.1 | 1.21.1 |
Show 11 moreShow less
| Package | Affected | Fixed |
|---|---|---|
go1.21SUSE:Linux Enterprise Module for Development Tools 15 SP4 From an advisory covering 5 CVEs |
before 1.21.1-150000.1.6.1 | 1.21.1-150000.1.6.1 |
go1.21SUSE:Linux Enterprise Module for Development Tools 15 SP5 From an advisory covering 5 CVEs |
before 1.21.1-150000.1.6.1 | 1.21.1-150000.1.6.1 |
go1.21openSUSE:Leap 15.4 From an advisory covering 5 CVEs |
before 1.21.1-150000.1.6.1 | 1.21.1-150000.1.6.1 |
go1.21openSUSE:Leap 15.5 From an advisory covering 5 CVEs |
before 1.21.1-150000.1.6.1 | 1.21.1-150000.1.6.1 |
go1.21-opensslSUSE:Linux Enterprise Module for Development Tools 15 SP4 From an advisory covering 10 CVEs |
before 1.21.4.1-150000.1.5.1 | 1.21.4.1-150000.1.5.1 |
go1.21-opensslSUSE:Linux Enterprise Module for Development Tools 15 SP5 From an advisory covering 10 CVEs |
before 1.21.4.1-150000.1.5.1 | 1.21.4.1-150000.1.5.1 |
go1.21-opensslopenSUSE:Leap 15.4 From an advisory covering 10 CVEs |
before 1.21.4.1-150000.1.5.1 | 1.21.4.1-150000.1.5.1 |
go1.21-opensslopenSUSE:Leap 15.5 From an advisory covering 10 CVEs |
before 1.21.4.1-150000.1.5.1 | 1.21.4.1-150000.1.5.1 |
goSUSE:Package Hub 12 From an advisory covering 8 CVEs |
before 1.21-41.1 | 1.21-41.1 |
go1.21SUSE:Package Hub 12 From an advisory covering 8 CVEs |
before 1.21.3-2.1 | 1.21.3-2.1 |
go1.21openSUSE:Tumbleweed From an advisory covering 4 CVEs |
before 1.21.1-1.1 | 1.21.1-1.1 |
Public exploits
Links only. Every CVE stores no exploit code.
| Source | Link | Date |
|---|---|---|
| PoC in GitHub | ayrustogaru/cve-2023-39320 | 2024-02-24 |
History
| Recorded | Changed | Sources |
|---|---|---|
| affected, facts | ||
| affected, aliases, references | OSV | |
| affected | ||
| aliases | EUVD | |
| first indexed | CVE List, GitHub Advisories, NVD, OSV, PoC in GitHub |
Dates are when Every CVE recorded each change. Upstream dates may differ.
In short
CVE-2023-39320 is a critical vulnerability (CVSS 9.8) in Go Toolchain Cmd/go, published September 7, 2023. Public exploit code exists. EPSS puts the chance of exploitation in the next 30 days at 1.76%, the 78th percentile. Fixed in go 1.21.1-r0.
References
go.dev/issue/62198
go.dev/cl/526158
groups.google.com/g/golang-dev/c/2C5vbR-UNkI/m/L1hdrPhfBAAJ
pkg.go.dev/vuln/GO-2023-2042
security.netapp.com/advisory/ntap-20231020-0004
security.gentoo.org/glsa/202311-09
Show 35 moreShow less
nvd.nist.gov/vuln/detail/CVE-2023-39320
github.com/advisories/GHSA-rxv8-v965-v333
security.alpinelinux.org/vuln/CVE-2023-39320
docs.bell-sw.com/security/cves/CVE-2023-39320
pkg.go.dev
github.com/CVEProject/cvelistV5/tree/main/cves/2023/39xxx/CVE-2023-39320.json
suse.com/support/update/announcement/2023/suse-su-20233701-1
bugzilla.suse.com/1212475
bugzilla.suse.com/1215084
bugzilla.suse.com/1215085
bugzilla.suse.com/1215086
bugzilla.suse.com/1215087
bugzilla.suse.com/1215090
suse.com/security/cve/CVE-2023-39318
suse.com/security/cve/CVE-2023-39319
suse.com/security/cve/CVE-2023-39320
suse.com/security/cve/CVE-2023-39321
suse.com/security/cve/CVE-2023-39322
suse.com/support/update/announcement/2023/suse-su-20234469-1
bugzilla.suse.com/1212667
bugzilla.suse.com/1212669
bugzilla.suse.com/1215985
bugzilla.suse.com/1216109
bugzilla.suse.com/1216943
bugzilla.suse.com/1216944
suse.com/security/cve/CVE-2023-39323
suse.com/security/cve/CVE-2023-39325
suse.com/security/cve/CVE-2023-44487
suse.com/security/cve/CVE-2023-45283
suse.com/security/cve/CVE-2023-45284
ubuntu.com/security/CVE-2023-39320
github.com/golang/go/commit/d25a935574efd573668d8ce9ea4cfc530bb63ecb
groups.google.com/g/golang-announce/c/Fm51GRLNRvM
cve.org/CVERecord?id=CVE-2023-39320
lists.opensuse.org/archives/list/[email protected]/thread/PHLNOE5TP7BJKIUIINHT2OD2ZR672SJX
Left out here: the rest of 1 source description. The JSON record has them.