Advisory

GO-2024-2962

Also known as: BIT-golang-2023-24531, CVE-2023-24531

Summary

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

Details

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.

Severity

Not rated by the source.

Dates

Published
2024-07-02 19:27 UTC
Modified
2026-02-04 03:51 UTC

Affected packages and fixes

toolchain

Go · All systems

Affected

  • introduced 0, fixed 1.21.0-0 (semver)

Fixed versions

1.21.0-0

Fix

The export has no generic command for this ecosystem.

Fix commands are the export's own generic commands. Ojuju never runs them. Check them against your setup first.

Check your own computer: guard packages check

View this record on OSV.dev

Source

Source: Go Vulnerability Database · CC BY 4.0

Sources & licences