Argument injection in Go toolchain linker flags via cgo directives
Key facts
- Attack vector
- Network
- Privileges required
- None
- User interaction
- Required
- Attack complexity
- Low
- Impact type
- Code execution
- Confidentiality · integrity · availability
- High · High · High
- Fix status
- Fixed
Attack profile from CVSS 3.1 · CISA ADP. Fix status from CNA. Impact type from CWE-88.
Summary
Go toolchain cmd/cgo, cmd/compile and cmd/link before 1.26.11 and from 1.27.0-0 before 1.27.4 fail to validate library names, so unsafe arguments reach the external linker. A user who builds a crafted package that uses //go:cgo_import_dynamic, or links a crafted PE object on Windows, can trigger this with user interaction. On Windows, a crafted DLL name containing .. can make the linker reference arbitrary files on disk.
Written with Claude Haiku 5.5 from the sources below · 2026-11-16
Description from the CNA
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 "@".
Why it matters now
SSVC decision points
CISA ADP · SSVC 2.0.3
- Exploitation
- None
- Automatable
- No
- Technical impact
- Total
The decision (Track, Attend, Act) also depends on your mission and well-being impact; see CISA's SSVC guide.
Affected products
| Vendor | Product | Affected versions | Fixed in | Status | Source |
|---|---|---|---|---|---|
| Go standard library | cmd/cgo | before 1.26.11; 1.27.0-0 to before 1.27.4 | 1.26.11, 1.27.4 | Patch available | CNA |
| Go standard library | cmd/compile | before 1.26.11; 1.27.0-0 to before 1.27.4 | 1.26.11, 1.27.4 | Patch available | CNA |
| Go standard library | cmd/link | before 1.26.11; 1.27.0-0 to before 1.27.4 | 1.26.11, 1.27.4 | Patch available | CNA |
- cmd/cgo VendorGo standard library Affected before 1.26.11; 1.27.0-0 to before 1.27.4 Fixed in 1.26.11, 1.27.4 Patch available CNA
- cmd/compile VendorGo standard library Affected before 1.26.11; 1.27.0-0 to before 1.27.4 Fixed in 1.26.11, 1.27.4 Patch available CNA
- cmd/link VendorGo standard library Affected before 1.26.11; 1.27.0-0 to before 1.27.4 Fixed in 1.26.11, 1.27.4 Patch available CNA
Remediation
Upgrade cmd/cgo, cmd/compile and cmd/link to 1.26.11 or 1.27.4, whichever matches your release branch.
Written with Claude Haiku 5.5 from the sources below · 2026-11-16
- Fix · CNA cmd/cgo (Go toolchain) Fixed in 1.26.11, 1.27.4
- Fix · CNA cmd/compile (Go toolchain) Fixed in 1.26.11, 1.27.4
- Fix · CNA cmd/link (Go toolchain) Fixed in 1.26.11, 1.27.4
Fixed in the same release
Records fixed by the same vendor advisory or release, as the CNA lists them.
- Release ·
Go toolchain cmd/link 1.26.11, 1.27.4
3 records Highest priority Priority MEDIUM 3 MEDIUM
Other records, highest priority first
- TI-2026-89559 Crafted .syso files inject cgo linker flags in Go cmd/go and cmd/linkPriority MEDIUM 48
- TI-2026-89560 Host linker flag injection via cgo directives in Go cmd/compile and cmd/linkPriority MEDIUM 40
- Release ·
Go toolchain cmd/compile 1.26.11, 1.27.4
3 records Highest priority Priority MEDIUM 3 MEDIUM
Other records, highest priority first
- TI-2026-89562 Quoting flaw in Go cgo directives allows code execution at build timePriority MEDIUM 40
- TI-2026-89560 Host linker flag injection via cgo directives in Go cmd/compile and cmd/linkPriority MEDIUM 40
Timeline
- 2026-11-11 Threatist record created from CVE-2026-97042
- 2026-11-11 Alias added: GHSA-jgj7-3254-vwmv
- 2026-11-16 CVSS score added · CISA ADP
- 2026-11-16 Weakness changed · CISA ADP
- 2026-11-16 CISA SSVC decision points changed
References
More Go standard library vulnerabilities
- TI-2020-00578 Spoofing in Windows CryptoAPI ECC certificate validation KEVCVSS 3.1HIGH 8.1
- TI-2023-23979 HTTP/2 request cancellation lets attackers exhaust server resources KEVCVSS 3.1HIGH 7.5
- TI-2023-24278 HTTP/2 CONTINUATION flood in net/http CVSS 3.1HIGH 7.5
- TI-2018-05208 The "go get" implementation in Go 1.9.4, when the -insecure command-line option is used… CVSS 3.1HIGH 8.8
- TI-2024-16309 Panic when parsing invalid palette-color images in golang.org/x/image CVSS 3.1HIGH 7.5
- TI-2022-20112 Request smuggling due to improper request handling in golang.org/x/net/http2/h2c CVSS 3.1HIGH 7.5
Sources
- CVE-2026-97042 · CVE Program
- CVE-2026-97042 · NVD
- FIRST EPSS
- GHSA-jgj7-3254-vwmv · GitHub Advisory Database · CC BY 4.0
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences