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

Weaknesses

  • — CWE-88: Improper Neutralization of Argument Delimiters in a Command ('Argument Injection')

Affected products

VendorProductVersions
Go toolchaincmd/cgo0 to <1.26.11 [affected]; 1.27.0-0 to <1.27.4 [affected]
Go toolchaincmd/compile0 to <1.26.11 [affected]; 1.27.0-0 to <1.27.4 [affected]
Go toolchaincmd/link0 to <1.26.11 [affected]; 1.27.0-0 to <1.27.4 [affected]

References

Authoritative sources

This page is a snapshot. For the latest enrichment and updates, view the record on CVE.org or the NVD.

Assess this vulnerability

Compare your deployed product and version with the source record. Review vendor references for fixes and workarounds. A CVSS score describes technical severity; it does not establish that your systems are affected or that exploitation has occurred.

Browse all CVE security advisories · Symaro cybersecurity services

Generated from the official CVE List on 11 Nov 2026 08:04 UTC.