Arbitrary code execution during build on darwin via "-l to_library" in cgo in cmd/go
- State
- Published
- Severity
- 8.8 High
- Published
- Nov 11, 2026
- Updated
- Nov 17, 2026
- Reserved
- Sep 23, 2026
Description
On Darwin, building a malicious package that uses cgo could cause arbitrary code execution when using the Apple linker due to passing "-l to_library <path>" in a "#cgo LDFLAGS" directive. The Apple linker recombines the separated arguments "-l" and "to_library" into "-lto_library", which loads an arbitrary LTO plugin dynamic library at link time. The go command now disallows "-l" followed by "to_library" in "#cgo LDFLAGS", rejects "-lazy_library", "-lazy_framework", "-load_hidden", "-library", and "-library-path", and checks recombined "-l" arguments against disallowed linker flags and patterns.
| Product | Versions |
|---|---|
| cmd/go Go toolchain | before 1.26.11 Affected1.27.0-0 to before 1.27.4 Affected |
| CVSS | Score | How It's Reached | Source |
|---|---|---|---|
| 3.1 | 8.8 High | CISA-ADP |
Weaknesses
- CWE-88 Improper Neutralization of Argument Delimiters in a Command ('Argument Injection')
References
Every record here comes from the CVE Program's CVE List. © 1999-2026 The MITRE Corporation. CVE is a registered trademark of The MITRE Corporation. The records are reproduced under the CVE Program terms of use.