9.8critical
Output of "go env" does not sanitize values in cmd/go
- Severity
- 9.8critical CVSS:3.1 by CISA-ADP
- Exploit likelihood
- 0.83% (higher than 58% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- Go
- Also known as
- GO-2024-2962BIT-GOLANG-2023-24531
Description
Command go env is documented as outputting a shell script containing the Go environment. However, go env doesn't sanitize values, so executing its output as a shell script can cause various bad bahaviors, including executing arbitrary commands or inserting new environment variables. This issue is relatively minor because, in general, if an attacker can set arbitrary environment variables on a system, they have better attack vectors than making "go env" print them out.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| cmd/go | before 1.21.0-0 | CVE List |
| gotoolchain cmd\/go | before 1.21.0-0 | CVE List |
| toolchain (Go) | before 1.21.0-0 | Go Vulnerability Database |
| golang (Bitnami) | before 1.21.0-0 | Bitnami Vulnerability Database |
All scores
| CISA-ADP | 9.8critical CVSS:3.1 | CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H |
| Bitnami Vulnerability Database | critical rating |
Classification
SSVC (CISA-ADP): exploitation none, automatable yes, technical impact total.
What each source says
CVE List
Command go env is documented as outputting a shell script containing the Go environment. However, go env doesn't sanitize values, so executing its output as a shell script can cause various bad bahaviors, including executing arbitrary commands or inserting new environment variables. This issue is relatively minor because, in general, if an attacker can set arbitrary environment variables on a system, they have better attack vectors than making "go env" print them out.
NVD (es)
Está documentado que el comando go env genera un script de shell que contiene el entorno Go. Sin embargo, go env no sanitiza los valores, por lo que ejecutar su salida como un script de shell puede causar varios malos comportamientos, incluida la ejecución de comandos arbitrarios o la inserción de nuevas variables de entorno. Este problema es relativamente menor porque, en general, si un atacante puede establecer variables de entorno arbitrarias en un sistema, tiene mejores vectores de ataque que hacer que "go env" las imprima.
References
Related
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2023-24531 changed 2025-03-28 | CVE Terms of Use |
| Go Vulnerability Database | GO-2024-2962 changed 2026-02-04 | CC-BY-4.0 |
| NVD | CVE-2023-24531 changed 2026-06-17 | Public domain |
| Bitnami Vulnerability Database | BIT-GOLANG-2023-24531 changed 2025-05-20 | Apache-2.0 |