CVE-2023-39323
JSON

8.1high

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

Severity
8.1high CVSS:3.1 by CISA-ADP
Exploit likelihood
1.91% (higher than 80% of CVEs; EPSS, by FIRST)
Published
Last changed
Assigned by
Go
Also known as
GO-2023-2095BIT-GOLANG-2023-39323

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

Product or packageVersionsReported by
cmd/gobefore 1.20.9, from 1.21.0-0 before 1.21.2CVE List
toolchain (Go)before 1.20.9, from 1.21.0-0 before 1.21.2Go Vulnerability Database
golang gobefore 1.20.9, from 1.21.0 before 1.21.2NVD
fedoraproject fedora37, 38, 39NVD
golang (Bitnami)before 1.20.9, from 1.21.0 before 1.21.2Bitnami Vulnerability Database

All scores

CISA-ADP8.1high CVSS:3.1CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H
NVD8.1high CVSS:3.1CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H
Bitnami Vulnerability Databasehigh rating

Classification

SSVC (CISA-ADP): exploitation none, automatable no, technical impact total.

What each source says

CVE List

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.

NVD (es)

Las directivas de línea ("//line") se pueden utilizar para evitar las restricciones de las directivas "//go:cgo_", permitiendo que se pasen indicadores bloqueados del enlazador y del compilador durante la compilación. Esto puede provocar la ejecución inesperada de código arbitrario al ejecutar "go build". La directiva de línea requiere la ruta absoluta del archivo en el que se encuentra la directiva, lo que hace que explotar este problema sea significativamente más complejo.

References

https://go.dev/issue/63211fix, issue-tracking, patch, report
https://go.dev/cl/533215fix, patch
https://groups.google.com/g/golang-announce/c/XBa1oHDevAodiscussion, mailing-list, release-notes, web
https://pkg.go.dev/vuln/GO-2023-2095advisory, vendor-advisory
https://security.netapp.com/advisory/ntap-20231020-0001/advisory, third-party-advisory
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/KSEGD2IWKNUO3DWY4KQGUQM5BISRWHQE/advisory, mailing-list, third-party-advisory
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/CLB4TW7KALB3EEQWNWCN7OUIWWVWWCG2/advisory, mailing-list, third-party-advisory
https://lists.fedoraproject.org/archives/list/package-announce@lists.fedoraproject.org/message/XFOIBB4YFICHDM7IBOP7PWXW3FX4HLL2/advisory, mailing-list, third-party-advisory
https://security.gentoo.org/glsa/202311-09advisory, third-party-advisory
https://nvd.nist.gov/vuln/detail/CVE-2023-39323web

Related

Sources

SourceRecordLicence
CVE ListCVE-2023-39323 changed 2025-06-12CVE Terms of Use
Go Vulnerability DatabaseGO-2023-2095 changed 2026-02-04CC-BY-4.0
NVDCVE-2023-39323 changed 2026-06-17Public domain
Bitnami Vulnerability DatabaseBIT-GOLANG-2023-39323 changed 2026-09-08Apache-2.0