CVE-2023-24531
JSON

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 packageVersionsReported by
cmd/gobefore 1.21.0-0CVE List
gotoolchain cmd\/gobefore 1.21.0-0CVE List
toolchain (Go)before 1.21.0-0Go Vulnerability Database
golang (Bitnami)before 1.21.0-0Bitnami Vulnerability Database

All scores

CISA-ADP9.8critical CVSS:3.1CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H
Bitnami Vulnerability Databasecritical rating

Classification

CWE-138

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

SourceRecordLicence
CVE ListCVE-2023-24531 changed 2025-03-28CVE Terms of Use
Go Vulnerability DatabaseGO-2024-2962 changed 2026-02-04CC-BY-4.0
NVDCVE-2023-24531 changed 2026-06-17Public domain
Bitnami Vulnerability DatabaseBIT-GOLANG-2023-24531 changed 2025-05-20Apache-2.0