CVE-2020-28367 Arbitrary code execution via the go command with cgo in cmd/go
Attackers can execute arbitrary code during build time by injecting malicious gcc flags via cgo directives in Go projects.
- Exploited in the wild
- Not known
- Login needed
- Not needed
- Attackable
- Over the internet
- Victim action needed
- A user has to click or open something
- Fix
- Available
What is CVE-2020-28367?
CVE-2020-28367 is a high-severity code injection vulnerability in Golang Go, published on 18 Nov 2020. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Official description
Code injection in the go command with cgo before Go 1.14.12 and Go 1.15.5 allows arbitrary code execution at build time via malicious gcc flags specified via a #cgo directive.
Weakness: CWE-94
Which versions are affected by CVE-2020-28367?
2 open source packages ship an affected version, including golang and toolchain. It affects 1 product.
| Package | Affected | Fixed in |
|---|---|---|
golang Bitnami | All versions | 1.14.12, 1.15.5 |
toolchain Go | All versions | 1.14.12, 1.15.5 |
Products include Golang Go.
How do I fix CVE-2020-28367?
Upgrade golang to a fixed version for your release line: 1.14.12 or 1.15.5.
Upgrade, and never evaluate templates, expressions or code built from user input. More about Code injection.
Is CVE-2020-28367 being exploited?
There is no known exploitation of CVE-2020-28367 in the wild and no public exploit code.
Other vulnerabilities in Golang Go
- CVE-2020-0601 Microsoft Windows CryptoAPI Spoofing
- CVE-2026-27143 Missing bound checks can lead to memory corruption in safe Go in cmd/compile
- CVE-2024-24790 Unexpected behavior from Is methods for IPv4-mapped IPv6 addresses in net/netip
- CVE-2023-39320 Arbitrary code execution via go.mod toolchain directive in cmd/go
- CVE-2023-24540 Improper handling of JavaScript whitespace in html/template
Sources
Also known as BIT-golang-2020-28367, DEBIAN-CVE-2020-28367, GHSA-827f-m9xx-4cfw, GO-2022-0476, UBUNTU-CVE-2020-28367.