All reports
Unknown

Output of "go env" does not sanitize values in cmd/go

Affected versions

Affected versions
<1.21.0-0
Fixed version
1.21.0-0

Exploitation

CVE-2023-24531

Probability of exploitation in the next 30 days: 0.83%

FIRST EPSS · 2026-11-23

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.

Links

Credits

  • Hunter Wittenborn (https://hunterwittenborn.com/)