Goal Reached Thanks to every supporter — we hit 100%!

Goal: 1000 CNY · Raised: 1359 CNY

100%

CVE-2026-97042— Linker flag injection via cgo_import_dynamic and PE DLL names in cmd/cgo, cmd/compile, and cmd/link

Quick assessment

Affected
Go toolchain cmd/cgo
Exploitation
No confirmed in-the-wild exploitation; assess based on exposure
Recommended action
Check the vendor advisory and references for a fixed version. If immediate upgrade is impossible, restrict exposure and increase monitoring.

构建一个利用 或在 Windows 上链接经过篡改的 PE 对象的恶意包,可能向外部链接器传递不安全的库参数。此前,编译器仅检查 指令中库名的第一个字符,并在 cgo 生成的文件中跳过了验证。此外,在 Windows 上, 和 在将 PE 对象文件中提取的导入 DLL 名称转换为 标志传递给外部链接器之前,未对 DLL 名称进行验证。这导致攻击者可构造包含 路径遍历或特殊字符的 DLL 名称,从而引用磁盘上的任意文件。 现在,编译器会验证 指令中库名的每一个字符(包括 Windows 上 cgo 生成的文件中的库名

AI Predicted 8.8 Difficulty: Moderate EPSS 0.45% · P40

Affected Version Matrix 6

VendorProduct Version RangeStatus
Go toolchain cmd/cgo < 1.26.11 affected
1.27.0-0< 1.27.4 affected
Go toolchain cmd/compile < 1.26.11 affected
1.27.0-0< 1.27.4 affected
Go toolchain cmd/link < 1.26.11 affected
1.27.0-0< 1.27.4 affected
Get alerts for future matching vulnerabilities Log in to subscribe

I. Basic Information for CVE-2026-97042

Vulnerability Information

Have questions about the vulnerability? See if Shenlong's analysis helps!
View Shenlong Deep Dive ↗

Although we use advanced large model technology, its output may still contain inaccurate or outdated information.Shenlong tries to ensure data accuracy, but please verify and judge based on the actual situation.

Vulnerability Title
Linker flag injection via cgo_import_dynamic and PE DLL names in cmd/cgo, cmd/compile, and cmd/link
Source: CVE Program / CVE List V5
Vulnerability Description
Building a malicious package that uses "//go:cgo_import_dynamic" or links against a crafted PE object on Windows could pass unsafe library arguments to the external linker. The compiler only checked the first character of the library name in "//go:cgo_import_dynamic" directives and skipped validation in cgo-generated files. In addition, on Windows, "cmd/cgo" and "cmd/link" did not validate imported DLL names extracted from PE object files before emitting "-l<name>" flags for the external linker, allowing a crafted DLL name containing ".." path traversal or special characters to reference arbitrary files on disk. The compiler now validates every character of the library name in "//go:cgo_import_dynamic" directives (including in cgo-generated files on Windows) and rejects ".." path traversal, and "cmd/cgo" and "cmd/link" reject PE imported DLL names containing path separators, "..", ":", or leading "-" or "@".
Source: CVE Program / CVE List V5
CVSS Information
N/A
Source: CVE Program / CVE List V5
Vulnerability Type
N/A
Source: CVE Program / CVE List V5

Affected Products

Vendor Product Affected Versions CPE Subscribe
Go toolchain cmd/cgo 0 ~ 1.26.11 -
Go toolchain cmd/compile 0 ~ 1.26.11 -
Go toolchain cmd/link 0 ~ 1.26.11 -

II. Public POCs for CVE-2026-97042

# POC Description Source Link Shenlong Link
AI-Generated POC Premium

No public POC found.

Login to generate AI POC

III. Intelligence Information for CVE-2026-97042

请登录查看更多情报信息。

Vendor Advisories for CVE-2026-97042 (2)

Other References for CVE-2026-97042 (1)

Other References for CVE-2026-97042 (1)

Same Patch Batch · Go toolchain · 2026-11-11 · 11 CVEs total

CVE-2026-97043 Unexpected code execution via escaped quotes in //go:cgo_ldflag in cmd/go and cmd/compile
CVE-2026-97040 Cgo directive injection via .syso files disguised as Go object files in cmd/go and cmd/lin
CVE-2026-97038 Arbitrary code execution via crafted .syso files and cgo linker input files in cmd/go
CVE-2026-97034 Arbitrary command execution via GCC spec files in cgo linker search directories in cmd/go
CVE-2026-97036 Arbitrary code execution during build on darwin via "-l to_library" in cgo in cmd/go
CVE-2026-97039 Flag sanitization bypass via "#cgo pkg-config:" directives in cmd/go
CVE-2026-97037 Linker script injection via split -Wl, flags and Darwin or symbol linker flags in cgo in c
CVE-2026-97035 Unexpected code execution and arbitrary file write via Clang -gen-* and GCC -gnat* flags i
CVE-2026-97033 Unexpected code execution via --sysroot, -target, -isysroot, -Wl,-syslibroot, and -x cgo f
CVE-2026-97041 Host linker flag injection via //go:cgo_* directives in cmd/compile and cmd/link

IV. Related Vulnerabilities