CVE-2026-97036

Arbitrary code execution during build on darwin via "-l to_library" in cgo in cmd/go

Published Nov 11, 2026 CVSS n/a EPSS < 1% KEV · Not listed
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.

Remediation

No solution or workaround provided in the CVE record

Tracking

Sign in to view the affected projects.

Advisories

No advisories available
History
Type Values Removed Values Added
Weaknesses CWE-20
Type Values Removed Values Added
Weaknesses CWE-78
Type Values Removed Values Added
Weaknesses CWE-78
Type Values Removed Values Added
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.
Title Arbitrary code execution during build on darwin via "-l to_library" in cgo in cmd/go
References

Subscriptions

No data.

Weaknesses

Sources

Status
PUBLISHED
Assigner
Go
Published
Updated
Nov 11, 2026, 3:13 AM
Reserved
Sep 23, 2026, 11:05 PM
Status
Awaiting Analysis
Published
Nov 11, 2026, 5:19 AM
Modified
Nov 12, 2026, 10:09 PM