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

Published Jul 2, 2024
·
Updated

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.

Other sources

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

Microsoft

Affected Software

11 affected componentsFixes available
debian/golang-1.15<=1.15.15-1~deb11u4
debian/golang-1.19<=1.19.8-2
Microsoft cbl2 msft-golang 1.24.1-2
Microsoft azl3 golang 1.23.8-1
Microsoft azl3 golang 1.21.0-1<1.21.0-1
1.21.0-1
Microsoft cbl2 golang 1.22.7-3
Microsoft cbl2 golang 1.21.0-1<1.21.0-1
1.21.0-1
Microsoft cbl2 msft-golang 1.21.0-1<1.21.0-1
1.21.0-1
Microsoft cbl2 golang 1.18.8-8
Microsoft cbl2 golang 1.18.8-10
Microsoft cbl2 golang 1.18.8-9

Remediation

Recommended actions to resolve this vulnerability, in priority order.

  1. Upgrade

    Upgrade to a fixed release to a version that resolves this vulnerability.

    Fixed in 1.21.0-1

Event History

Jul 2, 2024
CVE Published
via MITRE·07:51 PM
Data Sourced
via MITRE·07:51 PM
DescriptionWeakness
Data Sourced
via NVD·08:15 PM
DescriptionSeverity
Nov 15, 2024
Data Sourced
via Ubuntu·01:20 PM
RemedyDescriptionSeverityAffected Software
Sep 3, 2025
Data Sourced
via Microsoft·07:39 PM
DescriptionSeverityWeaknessAffected Software
Updated
via Microsoft·07:39 PM
Affected Software
Updated
via Microsoft·07:39 PM
SeverityAffected Software
Sep 4, 2025
Updated
via Microsoft·02:39 AM
DescriptionSeverity
Updated
via Microsoft·02:39 AM
SeverityAffected Software

Frequently Asked Questions

1

What is the severity of CVE-2023-24531?

CVE-2023-24531 has been classified as a high severity vulnerability due to the risk of executing arbitrary commands.

2

How do I fix CVE-2023-24531?

To fix CVE-2023-24531, it is recommended to upgrade to a fixed version of the golang package beyond the affected versions.

3

What are the potential impacts of CVE-2023-24531?

The potential impacts of CVE-2023-24531 include the execution of arbitrary commands and unintended alterations to the environment variables.

4

Which versions of Go are affected by CVE-2023-24531?

Versions golang-1.15 up to 1.15.15-1~deb11u4 and golang-1.19 up to 1.19.8-2 are affected by CVE-2023-24531.

5

How does CVE-2023-24531 exploit go env output?

CVE-2023-24531 exploits the go env output by not sanitizing values, allowing a shell script formed from its output to execute malicious commands.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203