CVE-2023-39323

published 5 Oct 2023 · updated 3 Sep 2026

Arbitrary code execution during build via line directives in cmd/go

8.1HighCVSS 8.1EPSS 2%

No exploitation in the wild has been reported. EPSS puts the chance of exploitation in the next 30 days at 2%. Fixed in 1.20.9 and 1.21.2.

Line directives ("//line") can be used to bypass the restrictions on "//go:cgo_" directives, allowing blocked linker and compiler flags to be passed during compilation. This can result in unexpected execution of arbitrary code when running "go build". The line directive requires the absolute path of the file in which the directive lives, which makes exploiting this issue significantly more complex.

Affected

Vendors, products and packages with version ranges

VendorProductVersionsFixed
Go toolchain<1.20.9, >=1.21.0-0 <1.21.21.20.9, 1.21.2

Timeline

Every event on this vulnerability

Embed

A live severity badge for an advisory, README or ticket

CVE-2023-39323 severity on Zeptric[![CVE-2023-39323](https://zeptric.io/badge/cve/CVE-2023-39323.svg)](https://zeptric.io/cve/CVE-2023-39323)