Go
CVE-2026-97042
Linker flag injection via cgo_import_dynamic and PE DLL names in cmd/cgo, cmd/compile, and cmd/link
- Severity
- High 8.8
- Published
- 11 Nov 2026
- Last changed
- 16 Nov 2026
- Added to UpHeron
- 23 Nov 2026
- Fixed in
- 1.26.11, 1.27.4
- Exploit chance
- 0.6% in the next 30 daysHigher than 48% of CVEs. EPSS by FIRST, 24 Nov 2026
- Weakness
- Argument injection (CWE-88)
- Attack
- Over the network · No login needed · Needs someone to click or open something
- Attacker can
- Read data · Change data · Take it down
- CVSS vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:H- Sources
- CVE Program
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 "@".
Affected software
| Software | Affected versions |
|---|---|
cmd/cgoGo · osv:Go:cmd/cgo |
|
cmd/compileGo · osv:Go:cmd/compile |
|
cmd/linkGo · osv:Go:cmd/link |
|
About cmd/cgo
This is the only vulnerability in cmd/cgo in our list.
About cmd/compile
Vulnerabilities in cmd/compile
- In our list
- 3
- Published in the last 12 months
- 3
- Critical, last 12 months
- 0
- High, last 12 months
- 3
- Known exploited
- 0
- CVE-2026-97041Host linker flag injection via //go:cgo_* directives in cmd/compile and cmd/linkHigh 8.8 11 Nov 2026
- CVE-2026-97043Unexpected code execution via escaped quotes in //go:cgo_ldflag in cmd/go and cmd/compileHigh 8.8 11 Nov 2026
About cmd/link
Vulnerabilities in cmd/link
- In our list
- 3
- Published in the last 12 months
- 3
- Critical, last 12 months
- 1
- High, last 12 months
- 2
- Known exploited
- 0
- CVE-2026-97040Cgo directive injection via .syso files disguised as Go object files in cmd/go and cmd/linkCritical 9.8 11 Nov 2026
- CVE-2026-97041Host linker flag injection via //go:cgo_* directives in cmd/compile and cmd/linkHigh 8.8 11 Nov 2026
References
- CVE.org https://www.cve.org/CVERecord?id=CVE-2026-97042