You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
cmd/go: arbitrary code execution via crafted .syso files and cgo linker input files #82572
Building a malicious package containing ".syso" files or cgo linker inputs could
inject arbitrary linker flags or execute arbitrary code at link time.
Linker input files—including ".syso" files, direct object or library inputs in
"#cgo LDFLAGS", and libraries in "-L" directories—were passed to the external
linker without validating their format or checking for embedded linker options.
Across platforms, this allowed executing GNU ld implicit linker scripts
disguised as libraries or ".syso" files (or loaded via "-l:" 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, or invoking LTO plugins via GCC or LLVM LTO intermediate representation
sections in ELF, PE/COFF, or Mach-O objects.
The 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 disallows "-l:" and ":", "=", or path
separators in "-l" flags.
This issue was found by the Go Security Team during an internal audit.
Change https://go.dev/cl/861528 mentions this issue: [release-branch.go1.26] cmd/go: validate .syso and linker input files against scripts and embedded options
Change https://go.dev/cl/861489 mentions this issue: [release-branch.go1.27] cmd/go: validate .syso and linker input files against scripts and embedded options
changed the title [-]security: fix CVE-2026-97038[/-][+]cmd/go: arbitrary code execution via crafted .syso files and cgo linker input files[/+]on Nov 10, 2026
The reLinkerLibFile regex includes .so. , which matches the checksum filename. scanLinkerSearchDir consequently attempts to validate it as a binary, even though it is not selected by any linker flag.
We worked around this by copying only the required shared libraries into a separate build-only search directory, while preserving the original directory and checksum files for runtime integrity verification.
Could the filename detection be refined to avoid treating checksum files as versioned shared libraries?
Activity
nicholashusin commentedon Oct 26, 2026
Hi @gopherbot, please open backport issues for this security issue.
gopherbot commentedon Oct 26, 2026
Backport issue(s) opened: #82589 (for 1.26), #82590 (for 1.27).
Remember to create the cherry-pick CL(s) as soon as the patch is submitted to master, according to https://go.dev/wiki/MinorReleases.
gopherbot commentedon Nov 10, 2026
Change https://go.dev/cl/861528 mentions this issue:
[release-branch.go1.26] cmd/go: validate .syso and linker input files against scripts and embedded optionsgopherbot commentedon Nov 10, 2026
Change https://go.dev/cl/861489 mentions this issue:
[release-branch.go1.27] cmd/go: validate .syso and linker input files against scripts and embedded options[release-branch.go1.27] cmd/go: validate .syso and linker input files…
[release-branch.go1.26] cmd/go: validate .syso and linker input files…
[-]security: fix CVE-2026-97038[/-][+]cmd/go: arbitrary code execution via crafted .syso files and cgo linker input files[/+]gopherbot commentedon Nov 10, 2026
Change https://go.dev/cl/862151 mentions this issue:
cmd/go: validate .syso and linker input files against scripts and embedded optionscmd/go: validate .syso and linker input files against scripts and emb…
corani commentedon Nov 11, 2026
This change introduces a false positive when a #cgo LDFLAGS library search directory contains checksum files alongside shared libraries.
For example, our SDK ships both libexample.so and libexample.so.sha256 . After upgrading to Go 1.27.4, building fails with:
invalid linker input file in #cgo LDFLAGS: .../libexample.so.sha256 (unrecognized binary format)
The reLinkerLibFile regex includes .so. , which matches the checksum filename. scanLinkerSearchDir consequently attempts to validate it as a binary, even though it is not selected by any linker flag.
We worked around this by copying only the required shared libraries into a separate build-only search directory, while preserving the original directory and checksum files for runtime integrity verification.
Could the filename detection be refined to avoid treating checksum files as versioned shared libraries?
CynanX commentedon Nov 11, 2026
I'm seeing this also when using pact-go.
fix(ffi): strip LLVM bitcode from prebuilt Go static libs
fix(ffi): strip LLVM bitcode from prebuilt Go static libs (#2399)