CVE-2023-39323

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

State
Published
Severity
8.1 High
Published
Oct 5, 2023
Updated
Jun 12, 2025
Reserved
Jul 27, 2023

Read the record on cve.org

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.

Scores

CVSSScoreVectorSource
3.18.1 HighCVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:HCISA-ADP

Weaknesses

The record names no weakness.

Affected Products

ProductVersions
cmd/goGo toolchain
  • before 1.20.9Affected
  • 1.21.0-0 to before 1.21.2Affected

References

Every record here comes from the CVE Program’s CVE List. © 1999–2026 The MITRE Corporation. CVE is a registered trademark of The MITRE Corporation. The records are reproduced under the CVE Program terms of use.