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 package | Versions | Reported by |
|---|---|---|
| cmd/go | before 1.20.9, from 1.21.0-0 before 1.21.2 | CVE List |
| toolchain (Go) | before 1.20.9, from 1.21.0-0 before 1.21.2 | Go Vulnerability Database |
| golang go | before 1.20.9, from 1.21.0 before 1.21.2 | NVD |
| fedoraproject fedora | 37, 38, 39 | NVD |
| golang (Bitnami) | before 1.20.9, from 1.21.0 before 1.21.2 | Bitnami Vulnerability Database |
All scores
| CISA-ADP | 8.1high CVSS:3.1 | CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H |
| NVD | 8.1high CVSS:3.1 | CVSS:3.1/AV:N/AC:H/PR:N/UI:N/S:U/C:H/I:H/A:H |
| Bitnami Vulnerability Database | high 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/63211 | fix, issue-tracking, patch, report | |
| https://go.dev/cl/533215 | fix, patch | |
| https://groups.google.com/g/golang-announce/c/XBa1oHDevAo | discussion, mailing-list, release-notes, web | |
| https://pkg.go.dev/vuln/GO-2023-2095 | advisory, 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-09 | advisory, third-party-advisory | |
| https://nvd.nist.gov/vuln/detail/CVE-2023-39323 | web | |
Related
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2023-39323 changed 2025-06-12 | CVE Terms of Use |
| Go Vulnerability Database | GO-2023-2095 changed 2026-02-04 | CC-BY-4.0 |
| NVD | CVE-2023-39323 changed 2026-06-17 | Public domain |
| Bitnami Vulnerability Database | BIT-GOLANG-2023-39323 changed 2026-09-08 | Apache-2.0 |