What’s Vulnerable › Vulnerabilities

CVE-2023-39323: Arbitrary code execution during build via line directives in cmd/go

Description

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 products

How to fix

Upgrade to a fixed version: Go 1.20.9, 1.21.2. Check the vendor advisory for mitigations.

References

Get alerted when CVE-2023-39323 or the next vulnerability affects your stack