SEVERITY NOT PROVIDED EPSS 0.6% · 48th percentile

CVE-2026-97042: Linker flag injection via cgo_import_dynamic and PE DLL names in cmd/cgo, cmd/compile, and cmd/link

Published 2026-11-11 · Updated 2026-11-25 · Also known as GO-2026-6849

Summary

A linker flag injection vulnerability in the Go toolchain (cmd/cgo, cmd/compile, and cmd/link) allows unsafe library arguments and path traversal sequences to be passed to the external linker. Development and build teams using vulnerable Go toolchain releases should update to patched versions.

Who is affected

The flaw affects environments using vulnerable versions of the Go toolchain when compiling packages containing crafted //go:cgo_import_dynamic directives or linking against malicious PE object files on Windows. Lack of validation on imported DLL names allows unvalidated flags containing path traversal ('..') or special characters to be passed to the external linker. This enables referencing arbitrary files on disk during the compilation process.

Exploitability

The CVSS vector and base score are not documented for this vulnerability. The EPSS score is 0.006, placing it in the 0.481 percentile. CISA Known Exploited Vulnerabilities lists active exploitation as no.

Remediation

How to check your project

Automated analysis of the published advisory data, generated 2026-11-25. Not human-reviewed; verify against the official advisory. How this works.

Affected packages

EcosystemPackageAffected versionsFixed inUpgrade
Go toolchain >= 0, < 1.26.11 1.26.11 go get [email protected]
Go toolchain >= 1.27.0-0, < 1.27.4 1.27.4 go get [email protected]

FAQ

What component of the Go toolchain is vulnerable?

The vulnerability exists in cmd/cgo, cmd/compile, and cmd/link due to incomplete validation of library names in //go:cgo_import_dynamic directives and unvalidated PE imported DLL names on Windows.

Is there any documented workaround for this issue?

No workarounds are documented; affected installations should upgrade to fixed Go toolchain versions.

Is this issue known to be actively exploited?

No, according to CISA's Known Exploited Vulnerabilities status, active exploitation is not documented.

Original advisory 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 "@".

References

Source records: GO-2026-6849 (OSV.dev) · EPSS by FIRST, 2026-11-25.