All vulnerabilities

Go

CVE-2026-97039

Flag sanitization bypass via "#cgo pkg-config:" directives in cmd/go

Severity
High 8.3
Published
11 Nov 2026
Last changed
16 Nov 2026
Added to UpHeron
23 Nov 2026
Fixed in
1.26.11, 1.27.4
Exploit chance
0.5% in the next 30 daysHigher than 42% of CVEs. EPSS by FIRST, 24 Nov 2026
Weakness
Argument injection (CWE-88)
Attack
Over the network · No login needed · Needs someone to click or open something
Attacker can
Read data · Change data · Slow it down
CVSS vector
CVSS:3.1/AV:N/AC:L/PR:N/UI:R/S:U/C:H/I:H/A:L
Sources
CVE Program

Description

Building a malicious package that uses "#cgo pkg-config:" directives could load untrusted pkg-config ".pc" files or inject unvalidated compiler and linker flags. The pkg-config flag allowlist previously permitted "--with-path=" and "--personality=", allowed "--define-variable=" values beginning with "=" or "$" (which can rewrite paths in system ".pc" files into sysroot-prefixed "-L=" or "-L$SYSROOT" linker search paths), and allowed package arguments ending in ".pc" or containing path separators or "..", which caused pkg-config to load local ".pc" files directly from the package directory. In addition, flags returned by "pkg-config --cflags" in cgoCPPFLAGS were not checked when determining whether internal linking is safe. The go command now disallows "--with-path=", "--personality=", leading "=" or "$" characters in "--define-variable=" values, and local ".pc" paths in "#cgo pkg-config:" directives, and inspects cgoCPPFLAGS when checking internal linking compatibility.

From the CVE Program.

Affected software

SoftwareAffected versions
cmd/goGo · osv:Go:cmd/go
  • Every version before 1.26.11
  • From 1.27.0-0 before 1.27.4

About cmd/go

References

  • CVE.org https://www.cve.org/CVERecord?id=CVE-2026-97039