Skip to content

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)

  1. Compiler-subprogram relocation and CWD tool execution (GHSA-428h-9j26-5fcf / CVE-2026-97033): --sysroot in #cgo flags relocates GCC/Clang subprograms, spec files, and CRT startup objects to an attacker directory; Clang -target falls back to executing target helper tools from the current working directory; -isysroot/-Wl,-syslibroot could name a regular file that GNU ld.bfd interprets as a positional linker script; -x accepted arbitrary input languages. Fix: --sysroot/-target disallowed, sysroot paths verified not to be regular files, -x restricted to C/C++/ObjC/asm.
  2. GCC spec-file search-path execution (GHSA-775q-r7gv-cr2x / CVE-2026-97034): -fopenmp, -fopenacc, or -fsanitize= in #cgo LDFLAGS makes GCC's built-in link spec evaluate %:include(libgomp.spec)/%:include(libsanitizer.spec) and search -L dirs, sysroot multilib siblings, and the working directory for drop-in *.spec files, which execute commands. Fix: -L/-isysroot/-Wl,-syslibroot directories containing spec files are rejected, @/- prefixes in -fsanitize= values disallowed.
  3. 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 between go and the compiler driver so later arguments passed to the linker unvalidated.
  4. Darwin argument recombination (GHSA-qxq7-88pj-2ph7 / CVE-2026-97036): Apple's linker re-joins separated -l + to_library into -lto_library, loading an arbitrary LTO plugin dylib at link time; -lazy_library, -load_hidden, -library-path were similarly unconsidered.
  5. Split -Wl, flags ate a bare second argument (GHSA-f47v-97w8-qc5g / CVE-2026-97037): -Wl,-rpath, -Wl,--just-symbols, -Wl,-undefined without 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,-sectcreate arguments naming a regular file were parsed as linker scripts.
  6. Unvalidated linker input files (GHSA-q9p5-q4jx-v656 / CVE-2026-97038): .syso files, direct object/library inputs in #cgo LDFLAGS, and -L libraries went to the external linker without format validation, enabling GNU ld implicit linker scripts disguised as libraries (via -l:<filename> or -l with path separators), unallowlisted linker flags smuggled in PE/COFF .drectve sections or Mach-O LC_LINKER_OPTION load commands, and LTO-plugin invocation through IR sections.
  7. 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 .pc paths into attacker -L= search paths), and allowed package arguments ending in .pc or containing path separators/.., loading local .pc files from the package directory; cgoCPPFLAGS were unchecked in the internal-linking safety decision.
  8. Go-object-header .syso confusion (GHSA-9767-p5x8-v2p2 / CVE-2026-97040): a .syso beginning with a go object header was parsed as a Go compiler object, so embedded cgo_ldflag/cgo_dynamic_linker metadata reached the external linker unvalidated; long .syso names lost their extension in 16-byte archive-header truncation.
  9. Comma injection in //go:cgo_* directives (GHSA-537w-q924-jhpm / CVE-2026-97041): commas in //go:cgo_import_dynamic/cgo_export_*/cgo_dynamic_linker split -Wl,--export-dynamic-symbol= and -Wl,--dynamic-linker, into arbitrary host linker flags or response-file arguments (leading @); two-argument cgo_import_dynamic could overwrite already-exported symbol names.
  10. Windows PE imported-DLL names became -l<name> flags (GHSA-jgj7-3254-vwmv / CVE-2026-97042): only the first character of //go:cgo_import_dynamic library 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 -/@.
  11. Quote/parse asymmetry in //go:cgo_ldflag (GHSA-26gx-chjm-8pq7 / CVE-2026-97043): cmd/cgo wrote flags with strconv.Quote but cmd/compile and cmd/go re-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

  1. go install/go build of 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 for import "C", #cgo, and .syso to predict which ingestion paths carry the primitive.
  2. 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.
  3. Serialize/parse asymmetry between pipeline stages is the bug class. Leg 11 (strconv.Quote write, raw-quote split read), leg 5 (go's -Wl, tokenizing vs the driver's re-join), and leg 4 (-l + to_library re-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.
  4. File-format sniffing is a security boundary when the parser branch changes behavior. Leg 8's go object header routed a .syso through 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.
  5. 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, dropping libgomp.spec-style files, .pc files, or crafted .syso/PE objects into a checkout you control is the payload delivery; the fix bands (pre-1.26.11/1.27.4) plus go version on runners fingerprint exposure from inside CI.
  6. Fingerprint exposure cheaply: go version on 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/GOFLAGS only, 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 is touch /tmp/skillz-cgo-canary, a -gen-cdb-fragment-path pointing at a scratch directory, a fake .syso with a go object header, a local .pc file 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 #cgo directive or artifact byte layout, compiler/linker invocation captured via go 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.