CVE-2026-97042

Linker flag injection via cgo_import_dynamic and PE DLL names in cmd/cgo, cmd/compile, and cmd/link

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

Key facts

Published
11 Nov 2026
Last changed
11 Nov 2026
Assigned by
Go
EPSS
0.234% likely to be exploited in the next 30 days, higher than 14.426% of CVEs (scores for 15 Nov 2026)

Historical context and remediation

This reference retains the original CVE publication date. A recent record update does not mean a new attack occurred.

No separately sourced impact summary is available on this page yet. Consult the description, version data and dated exploitation evidence.

No explicit remediation statement is available on this page yet. Consult the original record and vendor references before choosing a fix.

Version statuses below come from the CNA. An “unaffected” version is not necessarily a currently supported release or proof of a patch date. EPSS is a dated risk estimate, not a count of historical attacks.

Read the original CVE record.

Affected products

VendorProductVersions
Go toolchaincmd/cgo
  • Default status: unaffected
  • 0 up to but excluding 1.26.11 (affected)
  • 1.27.0-0 up to but excluding 1.27.4 (affected)
Go toolchaincmd/compile
  • Default status: unaffected
  • 0 up to but excluding 1.26.11 (affected)
  • 1.27.0-0 up to but excluding 1.27.4 (affected)
Go toolchaincmd/link
  • Default status: unaffected
  • 0 up to but excluding 1.26.11 (affected)
  • 1.27.0-0 up to but excluding 1.27.4 (affected)

Timeline

  1. 11 Nov 2026 Published

References