Go toolchain: Arbitrary code execution during package linking (CVE-2026-97038)
The Go toolchain's cmd/go component is vulnerable to arbitrary code execution or the injection of arbitrary linker flags during the package linking phase when processing malicious .syso files or cgo linker inputs.
CVE search metadata
CVE search record: CVE-2026-97038. Severity: high. CVSS: 8.8. EPSS: 0.54%. KEV: no. Product: cmd/go. Brief: Go toolchain: Arbitrary code execution during package linking (CVE-2026-97038). Brief link: https://feed.craftedsignal.io/briefs/2026-11-go-toolchain-rce-cve-2026-97038/
Triage facts
Revision 1- Applicability
- cmd/go
- Evidence
- Unknown
- Severity
- High
- Sources
- 2 public sources
- Freshness
- Revision 1Nov 19, 20:21 UTC
- Vulnerabilities
- 1 CVE
- Source quality
- A2Roughly even chance
Overview
The Go toolchain's cmd/go component is vulnerable to arbitrary code execution during the package linking phase. Malicious packages containing crafted ".syso" files or cgo linker inputs allow for the injection of arbitrary linker flags or the execution of arbitrary code at link time. The issue arises because the go command previously failed to validate the format of or check for embedded linker options in several types of inputs: ".syso" files, direct object or library inputs in "#cgo LDFLAGS", and libraries in "-L" directories. These were passed to the external linker without verification.
Attack Chain
Attackers can leverage this vulnerability to perform several malicious actions:
- Executing GNU ld implicit linker scripts disguised as libraries or ".syso" files.
- Loading malicious inputs via "-l:<filename>" or "-l" containing path separators.
- Injecting unallowlisted linker flags via PE/COFF ".drectve" sections on Windows or Mach-O "LC_LINKER_OPTION" load commands on Darwin.
- Invoking LTO plugins via GCC or LLVM LTO intermediate representation sections in ELF, PE/COFF, or Mach-O objects.
The updated go command now verifies that ".syso" files, direct linker inputs, and libraries in "-L" directories are valid binary objects or archives that do not contain unallowlisted ".drectve" directives, "LC_LINKER_OPTION" load commands, or LTO IR sections, and it disallows "-l:<filename>" as well as ":", "=", or path separators in "-l" flags.
Impact
Successful exploitation results in arbitrary code execution at link time during the build process.
Recommendation
Users should upgrade the Go toolchain to version 1.26.11 or later for the 1.26.x branch, or version 1.27.4 or later for the 1.27.x branch, to incorporate the necessary validation logic for linker inputs.