Go toolchain cgo wave (11 GHSAs): build-time RCE from malicious modules via linker-flag smuggling¶
Source: coordinated GitHub Advisory wave published 2026-11-11 06:32Z, eleven advisories CVE-2026-97033 through CVE-2026-97043 against the Go toolchain (toolchain package, go command, cmd/cgo, cmd/compile, cmd/link), all fixed in Go 1.26.11 and 1.27.4 per the Go announcement thread and OSV records (verified GO-2026-6853, GO-2026-6858). GHSA links inline per leg below.
Wave in one line: every #cgo directive and .syso file inside a module you go build/go install is attacker-controlled content that reaches the host compiler and linker command line, and this single release fixed eleven independent ways to escape the go command's flag allowlist and execute code at build time.
Why this is durable operator value¶
Go's supply-chain story is "no postinstall scripts," so red teams and bounty hunters often treat Go module ingestion as lower-risk than npm/pip. This wave is the counter-evidence: cgo directives are declarative build content, require no script execution in the dependency itself, and still land arguments in gcc/clang/ld/pkg-config invocations on the build host. Anyone who can get a module into a go.mod, a GOPROXY mirror, a vendor directory, or a go install <attacker-url> habit has a build-host code-execution primitive on CI runners, developer workstations, and build farms, at the uid of the builder, with no artifact ever "running."
Genealogy: same build-boundary family as the June 12 esbuild/mise/flatpak-builder page (registry env to native binary, repository-local config self-trust, Git hooks on the build host) and the August 3 updater-source page (update/fetch source as the write target).
The eleven legs (fixed 1.26.11 / 1.27.4)¶
- Compiler-subprogram relocation and CWD tool execution (GHSA-428h-9j26-5fcf / CVE-2026-97033):
--sysrootin#cgoflags relocates GCC/Clang subprograms, spec files, and CRT startup objects to an attacker directory; Clang-targetfalls back to executing target helper tools from the current working directory;-isysroot/-Wl,-syslibrootcould name a regular file that GNU ld.bfd interprets as a positional linker script;-xaccepted arbitrary input languages. Fix:--sysroot/-targetdisallowed, sysroot paths verified not to be regular files,-xrestricted to C/C++/ObjC/asm. - GCC spec-file search-path execution (GHSA-775q-r7gv-cr2x / CVE-2026-97034):
-fopenmp,-fopenacc, or-fsanitize=in#cgo LDFLAGSmakes GCC's built-in link spec evaluate%:include(libgomp.spec)/%:include(libsanitizer.spec)and search-Ldirs, sysroot multilib siblings, and the working directory for drop-in*.specfiles, which execute commands. Fix:-L/-isysroot/-Wl,-syslibrootdirectories containing spec files are rejected,@/-prefixes in-fsanitize=values disallowed. - Allowlist wildcard matched unrelated two-argument flags (GHSA-6f8j-v7cw-qxpp / CVE-2026-97035): the
-g*wildcard matched Clang-gen-cdb-fragment-path <dir>and GCC-gnatO <file>, writing files to arbitrary directories and desynchronizing argument parsing betweengoand the compiler driver so later arguments passed to the linker unvalidated. - Darwin argument recombination (GHSA-qxq7-88pj-2ph7 / CVE-2026-97036): Apple's linker re-joins separated
-l+to_libraryinto-lto_library, loading an arbitrary LTO plugin dylib at link time;-lazy_library,-load_hidden,-library-pathwere similarly unconsidered. - Split
-Wl,flags ate a bare second argument (GHSA-f47v-97w8-qc5g / CVE-2026-97037):-Wl,-rpath,-Wl,--just-symbols,-Wl,-undefinedwithout a second-Wl,prefix passed the next token to the driver as a positional input file; on ld.bfd,-framework,-Wl,-R,-Wl,-subsystem,-Wl,-sectcreatearguments naming a regular file were parsed as linker scripts. - Unvalidated linker input files (GHSA-q9p5-q4jx-v656 / CVE-2026-97038):
.sysofiles, direct object/library inputs in#cgo LDFLAGS, and-Llibraries went to the external linker without format validation, enabling GNU ld implicit linker scripts disguised as libraries (via-l:<filename>or-lwith path separators), unallowlisted linker flags smuggled in PE/COFF.drectvesections or Mach-OLC_LINKER_OPTIONload commands, and LTO-plugin invocation through IR sections. - pkg-config directive abuse (GHSA-4x3g-87c5-vq62 / CVE-2026-97039): the allowlist permitted
--with-path=and--personality=, allowed--define-variable=values starting with=or$(rewriting system.pcpaths into attacker-L=search paths), and allowed package arguments ending in.pcor containing path separators/.., loading local.pcfiles from the package directory;cgoCPPFLAGSwere unchecked in the internal-linking safety decision. - Go-object-header
.sysoconfusion (GHSA-9767-p5x8-v2p2 / CVE-2026-97040): a.sysobeginning with ago objectheader was parsed as a Go compiler object, so embeddedcgo_ldflag/cgo_dynamic_linkermetadata reached the external linker unvalidated; long.sysonames lost their extension in 16-byte archive-header truncation. - Comma injection in
//go:cgo_*directives (GHSA-537w-q924-jhpm / CVE-2026-97041): commas in//go:cgo_import_dynamic/cgo_export_*/cgo_dynamic_linkersplit-Wl,--export-dynamic-symbol=and-Wl,--dynamic-linker,into arbitrary host linker flags or response-file arguments (leading@); two-argumentcgo_import_dynamiccould overwrite already-exported symbol names. - Windows PE imported-DLL names became
-l<name>flags (GHSA-jgj7-3254-vwmv / CVE-2026-97042): only the first character of//go:cgo_import_dynamiclibrary names was checked (validation skipped entirely in cgo-generated files), and imported DLL names in crafted PE objects were emitted as-l<name>without rejecting.., path separators,:, or leading-/@. - Quote/parse asymmetry in
//go:cgo_ldflag(GHSA-26gx-chjm-8pq7 / CVE-2026-97043):cmd/cgowrote flags withstrconv.Quotebutcmd/compileandcmd/gore-parsed by splitting on raw quote characters without handling backslash escapes, smuggling disallowed linker flags and unvalidated search paths past the checks.
Also in the same 06:32Z batch, tracked no-publish: GHSA-rg98-f588-44xg / CVE-2026-97054 (MaxBytesReader unsynchronized Connection: close header race, handler-concurrency panic, DoS-only).
Operator rules extracted¶
go install/go buildof untrusted modules is script execution. For red-team initial access and CI pivots, treat a merge request, a transitive dependency bump, a GOPROXY seed, or a README install command as a build-host RCE vector when the module contains cgo. No package-manager lifecycle script needed; grep candidate modules forimport "C",#cgo, and.sysoto predict which ingestion paths carry the primitive.- Prefix wildcards in allowlists are bypass inventory generators.
-g*matched-gen-*/-gnatO; byte-0 checks (-l<name>first char) matched nothing after position 0. When you audit any build/flag allowlist (CI wrappers, compiler frontends, container build tooling), enumerate the full flag grammar of the downstream tool, not just the intended family: two-argument flags, recombined arguments, and response-file prefixes (@) are the standard escape legs. - Serialize/parse asymmetry between pipeline stages is the bug class. Leg 11 (
strconv.Quotewrite, raw-quote split read), leg 5 (go's-Wl,tokenizing vs the driver's re-join), and leg 4 (-l+to_libraryre-joined by Apple ld) are the same finding: two parsers of one command line, validation at the first only. Probe every "the validator saw a different string than the executor" edge: escapes, commas, separated pairs, and OS-specific linker dialects. - File-format sniffing is a security boundary when the parser branch changes behavior. Leg 8's
go objectheader routed a.sysothrough the trusted metadata path; leg 6's unvalidated inputs hid linker scripts inside things named like libraries. Differential-test format headers on any tool that dispatches on magic bytes. - Search paths include the working directory. Legs 1, 2, and 7 all funnel to "drop a file the compiler/linker will find in CWD,
-L, or the package dir." For build-host access, droppinglibgomp.spec-style files,.pcfiles, or crafted.syso/PE objects into a checkout you control is the payload delivery; the fix bands (pre-1.26.11/1.27.4) plusgo versionon runners fingerprint exposure from inside CI. - Fingerprint exposure cheaply:
go versionon a runner/developer box vs the 1.26.11/1.27.4 bands; presence of cgo-enabled dependencies (go list -deps -f '{{.CgoFiles}}'style enumeration) predicts whether the linker legs apply at all.
Replayable validation boundaries (lab only)¶
- Disposable module + disposable GOPATH/
GOFLAGSonly, pinned lab Go toolchain, never a shared runner or a checkout holding cloud/registry credentials. - Use inert markers as the "arbitrary code": a
libgomp.spec-shaped file whose command istouch /tmp/skillz-cgo-canary, a-gen-cdb-fragment-pathpointing at a scratch directory, a fake.sysowith ago objectheader, a local.pcfile under the package dir. Positive proof is marker creation at build time on the pre-fix toolchain; negative control is the same tree on 1.26.11/1.27.4 rejecting the directive. - Keep every payload local: no network callbacks needed (unlike fetch-class bugs), no destructive commands, nothing that survives the disposable build dir.
- Evidence to keep: Go version, GOOS/GOARCH, toolchain path, the exact
#cgodirective or artifact byte layout, compiler/linker invocation captured viago build -x, marker path/metadata, and both-version decision table.
Related waves with the same shape: esbuild registry-env to native binary, mise .mise.toml/.tool-versions self-trust, flatpak-builder post-applypatch host execution (all on the June 12 build-boundary page), and repository-controlled .pdm-plugins pre-parse execution.