CVE-2023-24531: Output of "go env" does not sanitize values in cmd/go

CVE-2023-24531 affects 161 listed versions of Go in the Dawnsentry catalogue.

9.8CVSS critical
None knownexploitation
under 1%EPSS (next 30 days)
2 July 2024published

Affected products and versions

The versions in the Dawnsentry catalogue this CVE affects, judged from the vendor's own advisory where there is one, otherwise from the CVE record and NVD, as each version's own page says.

Go

161 of 250 listed versions are affected. Fixed in 1.21.0-0. The newest release, 1.27.4, is not affected.

1.21.0-rc3 1.20.14 1.20.13 1.20.12 1.20.11 1.20.10 1.20.9 1.20.8 1.20.7 1.20.6 1.20.5 1.20.4 1.20.3 1.20.2 1.20.1 1.20.0 1.19.13 1.19.12 1.19.11 1.19.10 1.19.9 1.19.8 1.19.7 1.19.6 1.19.5 1.19.4 1.19.3 1.19.2 1.19.1 1.19.0 1.19.0-rc2 1.18.10 1.18.9 1.18.8 1.18.7 1.18.6 1.18.5 1.18.4 1.18.3 1.18.2 1.18.1 1.18 1.17.13 1.17.12 1.17.11 1.17.10 1.17.9 1.17.8 1.17.7 1.17.6 1.17.5 1.17.4 1.17.3 1.17.2 1.17.1 1.17 1.16.15 1.16.14 1.16.13 1.16.12 and 101 more

What it is

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.

CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H (Go)

Published by Go on 2 July 2024. Last changed 17 June 2026.

Sources

Check one version you run: look CVE-2023-24531 up, or pick a product and version in the quick lookup.

Updated 2 December 2026.