{"id":"CVE-2026-97043","kind":"vulnerability","aliases":["CVE-2026-97043","GO-2026-6848"],"related":[],"title":"Unexpected code execution via escaped quotes in //go:cgo_ldflag in cmd/go and cmd/compile","description":"Building a malicious package that uses cgo could bypass \"#cgo LDFLAGS\" validation and cause unexpected code execution at build time, or cause the go command to panic, via crafted quoting in \"//go:cgo_ldflag\" directives.\n\nWhen \"cmd/cgo\" generates \"_cgo_gotypes.go\", it quotes each \"#cgo LDFLAGS\" argument with strconv.Quote in a \"//go:cgo_ldflag\" directive, but \"cmd/compile\" and \"cmd/go\" parsed those directives by splitting on raw quote characters without handling backslash escapes or unquoting the string. This mismatch allowed disallowed linker flags or unvalidated linker search paths to be smuggled past the go command's flag checks and passed to the external linker. In addition, deduplicating LDFLAGS in the go command could panic with an out-of-bounds slice index when a prefix of the flag list matched near the end of the slice.\n\n\"cmd/compile\" and \"cmd/go\" now properly handle backslash-escaped quotes and unquote \"//go:cgo_*\" pragma strings with strconv.Unquote, and the slice bounds check in processCgoOutputs has been fixed.","summary":"The Go toolchain mishandles escaped quotes in //go:cgo_ldflag directives, so a malicious package using cgo can smuggle disallowed linker flags past validation. The same flaw can also make the go command panic during LDFLAGS deduplication.","severity":"high","cvss":null,"epss":null,"exploited":false,"exploited_at":null,"products":[{"name":"toolchain","fixed":["1.26.11","1.27.4"],"affected":">= 1.27.0-0, < 1.27.4","ecosystem":"go"}],"ecosystems":["go"],"tags":["cgo","ci","go","runtime"],"not_affected_if":["pure-go-only","trusted-sources-only"],"how_to_check":"- Run `go version` and compare against the fixed releases listed in the sources.\n- Check whether builds compile packages that use cgo with `#cgo LDFLAGS` from third-party modules.","fix":"- Go `1.26.11`\n- Go `1.27.4`","status":"open","published_at":"2026-11-11T02:51:11+00:00","first_seen_at":"2026-11-11T03:37:16+00:00","triaged_at":"2026-11-11T03:38:52+00:00","updated_at":"2026-11-11T03:38:52+00:00","category":"runtime","confidence":0.7,"triage":{"at":"2026-11-11T03:38:52Z","model":"claude-haiku-5-5","output":{"fix":"- Go `1.26.11`\n- Go `1.27.4`","reach":"local","title":"Go toolchain: crafted cgo LDFLAGS can run code at build time","impact":"high","summary":"The Go toolchain mishandles escaped quotes in //go:cgo_ldflag directives, so a malicious package using cgo can smuggle disallowed linker flags past validation. The same flaw can also make the go command panic during LDFLAGS deduplication.","audience":"developers","category":"runtime","nicknames":[],"who_cares":["go","cgo","ci"],"confidence":0.7,"fix_status":"available","needs_auth":"no","worst_case":"Attacker code runs on the build machine during compilation.","analyst_note":"","how_to_check":"- Run `go version` and compare against the fixed releases listed in the sources.\n- Check whether builds compile packages that use cgo with `#cgo LDFLAGS` from third-party modules.","plain_action":"","product_name":"","needs_analyst":false,"not_affected_if":["pure-go-only","trusted-sources-only"],"who_is_affected":"Anyone building Go code with the affected toolchain, especially when compiling third-party packages that use cgo. Builds that use only pure Go code or trusted cgo sources are less exposed. unknown for further detail on specific build pipelines.","user_interaction":"no","product_ecosystem":"","needs_special_setup":"unknown","severity_if_unknown":"high"},"cost_usd":0.000736,"input_tokens":4887,"output_tokens":494,"severity_before":"unknown"},"analyst_status":null,"analyst_note":null,"search":"'-2026':16A,19A,22A '-6848':20A '-97043':17A,23A '/go':8A,36B,97C,115C,211C 'addit':168C 'allow':142C 'also':57B 'argument':110C 'backslash':134C,206C 'backslash-escap':205C 'bound':182C,220C 'build':66C,84C 'bypass':74C 'caus':79C,87C 'cgo':9A,25B,37B,45B,72C,75C,98C,108C,116C,212C 'cgo_gotypes.go':104C 'charact':131C 'check':160C,221C 'ci':26B 'cmd/cgo':102C 'cmd/compile':14A,120C,199C 'cmd/go':12A,122C,201C 'code':2A,81C 'command':61B,90C,157C,174C 'could':73C,175C 'craft':94C 'cve':15A,21A 'dedupl':65B,169C 'direct':39B,100C,118C,125C 'disallow':48B,143C 'end':195C 'escap':5A,33B,135C,207C 'execut':3A,82C 'extern':165C 'fix':226C 'flag':50B,145C,159C,190C 'flaw':55B 'generat':103C 'go':18A,27B,30B,60B,89C,156C,173C 'handl':133C,204C 'index':184C 'ldflag':10A,38B,64B,76C,99C,109C,117C,170C 'linker':49B,144C,148C,166C 'list':191C 'make':58B 'malici':42B,68C 'match':192C 'mishandl':32B 'mismatch':141C 'near':193C 'out-of-bound':179C 'packag':43B,69C 'panic':62B,92C,176C 'pars':123C 'pass':162C 'past':51B,154C 'path':150C 'pragma':213C 'prefix':187C 'processcgooutput':223C 'proper':203C 'quot':6A,34B,95C,106C,130C,208C 'raw':129C 'runtim':28B 'search':149C 'slice':183C,198C,219C 'smuggl':47B,153C 'split':127C 'strconv.quote':112C 'strconv.unquote':216C 'string':139C,214C 'time':85C 'toolchain':24A,31B 'unexpect':1A,80C 'unquot':137C,210C 'unvalid':147C 'use':44B,71C 'valid':52B,77C 'via':4A,93C 'without':132C","nicknames":[],"mitigations":[],"who_affected":"Anyone building Go code with the affected toolchain, especially when compiling third-party packages that use cgo. Builds that use only pure Go code or trusted cgo sources are less exposed. unknown for further detail on specific build pipelines.","tier":"B","verified":{},"analyst_revisit_at":null,"fix_status":"available","audience":"developers","plain_action":null,"pkeys":["toolchain"],"ptokens":["toolchain"],"labels":["cgo","ci","go","high","runtime"],"campaign_type":null,"search_a":"'-2026':16A,19A,22A '-6848':20A '-97043':17A,23A '/go':8A 'cgo':9A 'cmd/compile':14A 'cmd/go':12A 'code':2A 'cve':15A,21A 'escap':5A 'execut':3A 'go':18A 'ldflag':10A 'quot':6A 'toolchain':24A 'unexpect':1A 'via':4A","search_b":"'/go':36B 'also':57B 'cgo':25B,37B,45B 'ci':26B 'command':61B 'dedupl':65B 'direct':39B 'disallow':48B 'escap':33B 'flag':50B 'flaw':55B 'go':27B,30B,60B 'ldflag':38B,64B 'linker':49B 'make':58B 'malici':42B 'mishandl':32B 'packag':43B 'panic':62B 'past':51B 'quot':34B 'runtim':28B 'smuggl':47B 'toolchain':31B 'use':44B 'valid':52B","search_c":"'/go':97C,115C,211C 'addit':168C 'allow':142C 'argument':110C 'backslash':134C,206C 'backslash-escap':205C 'bound':182C,220C 'build':66C,84C 'bypass':74C 'caus':79C,87C 'cgo':72C,75C,98C,108C,116C,212C 'cgo_gotypes.go':104C 'charact':131C 'check':160C,221C 'cmd/cgo':102C 'cmd/compile':120C,199C 'cmd/go':122C,201C 'code':81C 'command':90C,157C,174C 'could':73C,175C 'craft':94C 'dedupl':169C 'direct':100C,118C,125C 'disallow':143C 'end':195C 'escap':135C,207C 'execut':82C 'extern':165C 'fix':226C 'flag':145C,159C,190C 'generat':103C 'go':89C,156C,173C 'handl':133C,204C 'index':184C 'ldflag':76C,99C,109C,117C,170C 'linker':144C,148C,166C 'list':191C 'malici':68C 'match':192C 'mismatch':141C 'near':193C 'out-of-bound':179C 'packag':69C 'panic':92C,176C 'pars':123C 'pass':162C 'past':154C 'path':150C 'pragma':213C 'prefix':187C 'processcgooutput':223C 'proper':203C 'quot':95C,106C,130C,208C 'raw':129C 'search':149C 'slice':183C,198C,219C 'smuggl':153C 'split':127C 'strconv.quote':112C 'strconv.unquote':216C 'string':139C,214C 'time':85C 'unexpect':80C 'unquot':137C,210C 'unvalid':147C 'use':71C 'valid':77C 'via':93C 'without':132C","cause_entry":null,"cause_path":null,"disclosures_checked_at":null,"first_public_at":"2026-11-11T02:51:11+00:00","kev":null,"cvss_vector":null,"cvss_by":null,"poc_count":0,"sources":[{"source":"govuln","external_id":"GO-2026-6848","url":"https://pkg.go.dev/vuln/GO-2026-6848","severity":null,"published_at":"2026-11-11T02:51:11+00:00","modified_at":"2026-11-11T02:51:11+00:00","first_seen_at":"2026-11-11T03:37:16+00:00","fetched_at":"2026-11-11T03:37:16+00:00","note":null}],"documents":[],"disclosures":[],"exploit_sources":[],"notice":"Free to read, with fair use of about 60 pages a minute. For higher limits or API access: sales@infrastack.ai"}