Skip to content
OpenAdvisories

Description

Building a malicious package that uses "//go:cgo_import_dynamic" or links against a crafted PE object on Windows could pass unsafe library arguments to the external linker. The compiler only checked the first character of the library name in "//go:cgo_import_dynamic" directives and skipped validation in cgo-generated files. In addition, on Windows, "cmd/cgo" and "cmd/link" did not validate imported DLL names extracted from PE object files before emitting "-l<name>" flags for the external linker, allowing a crafted DLL name containing ".." path traversal or special characters to reference arbitrary files on disk. The compiler now validates every character of the library name in "//go:cgo_import_dynamic" directives (including in cgo-generated files on Windows) and rejects ".." path traversal, and "cmd/cgo" and "cmd/link" reject PE imported DLL names containing path separators, "..", ":", or leading "-" or "@".

Affected products

VendorProductAffectedFixed
Go toolchain cmd/link 0 <1.26.11 —
Go toolchain cmd/cgo 0 <1.26.11 —
Go toolchain cmd/link 1.27.0-0 <1.27.4 —
Go toolchain cmd/compile 0 <1.26.11 —
Go toolchain cmd/compile 1.27.0-0 <1.27.4 —
Go toolchain cmd/cgo 1.27.0-0 <1.27.4 —

Fixed in Linux distributions

Distributions backport fixes, so the version that fixes this vulnerability differs per release — upgrade to at least the version shown. From the distributions' security trackers and advisories.

ReleasePackageFixed inAdvisory
Debian 14 golang-1.26 1.26.11-1 —
Debian 14 golang-1.27 1.27.4-1 —
Debian 13 golang-1.24 No fix yet —
Debian 12 golang-1.19 No fix yet —
ReleasePackageFixed inAdvisory
Ubuntu 26.10 golang-1.26 +1 No fix yet —
Ubuntu 26.04 LTS golang-1.23 +3 No fix yet —
Ubuntu 24.04 LTS golang-1.21 +5 No fix yet —
Ubuntu 22.04 LTS golang-1.17 +8 No fix yet —
Ubuntu 20.04 LTS golang-1.13 +5 No fix yet —
Show 7 more (older releases, extended support, other products)
ReleasePackageFixed inAdvisory
Ubuntu 18.04 LTS golang-1.8 +2 No fix yet —
Ubuntu 16.04 LTS golang-1.6 +1 No fix yet —
Ubuntu 14.04 LTS golang-1.10 No fix yet —
Ubuntu Pro 22.04 LTS golang-1.13 No fix yet —
Ubuntu Pro 20.04 LTS golang-1.16 No fix yet —
Ubuntu Pro 18.04 LTS golang-1.13 +2 No fix yet —
Ubuntu Pro 16.04 LTS golang-1.13 +1 No fix yet —
ReleasePackageFixed inAdvisory
openSUSE Tumbleweed go1.26 1.26.11-1.1 openSUSE-SU-2026:12529-1

Affected packages

EcosystemPackageAffectedFixedRecord
Go toolchain < 1.26.11 · >= 1.27.0-0, < 1.27.4 1.26.11, 1.27.4 GO-2026-6849

Advisories 2

References