ADVISORIES

Go Vulnerability Database

GO-2026-4338

Unexpected code execution when invoking toolchain in cmd/go

Details

Downloading and building modules with malicious version strings can cause local code execution.

On systems with Mercurial (hg) installed, downloading modules from non-standard sources (e.g., custom domains) can cause unexpected code execution due to how external VCS commands are constructed. This issue can also be triggered by providing a malicious version string to the toolchain.

On systems with Git installed, downloading and building modules with malicious version strings can allow an attacker to write to arbitrary files on the filesystem. This can only be triggered by explicitly providing the malicious version strings to the toolchain and does not affect usage of @latest or bare module paths.

Affected packages

EcosystemPackageAffected versions
Gotoolchain
All versions before 1.24.13 (fixed in 1.24.13)
From 1.25.0 before 1.25.6 (fixed in 1.25.6)

References