Improper handling of non-optional LDFLAGS in go command with cgo in cmd/go
Key facts
- Attack vector
- Network
- Privileges required
- None
- User interaction
- None
- Attack complexity
- Low
- Impact type
- Code execution
- Confidentiality · integrity · availability
- High · High · High
- Fix status
- Partial Red Hat: 5 fixed, 2 without a fix
Attack profile from CVSS 3.1 · CISA ADP. Fix status from CNA and Red Hat. Impact type from CWE-94.
Summary
The go command may execute arbitrary code at build time when using cgo. This may occur when running "go get" on a malicious module, or when running any other command which builds untrusted code. This is can by triggered by linker flags, specified via a "#cgo LDFLAGS" directive. The arguments for a number of flags which are non-optional are incorrectly considered optional, allowing disallowed flags to be smuggled through the LDFLAGS sanitization. This affects usage of both the gc and gccgo compilers.
Why it matters now
SSVC decision points
CISA ADP · SSVC 2.0.3
- Exploitation
- None
- Automatable
- Yes
- Technical impact
- Total
The decision (Track, Attend, Act) also depends on your mission and well-being impact; see CISA's SSVC guide.
Affected products
| Vendor | Product | Affected versions | Fixed in | Status | Source |
|---|---|---|---|---|---|
| Go standard library | cmd/go | before 1.19.10; 1.20.0-0 to before 1.20.5 | 1.19.10, 1.20.5 | Patch available | CNA |
- cmd/go VendorGo standard library Affected before 1.19.10; 1.20.0-0 to before 1.20.5 Fixed in 1.19.10, 1.20.5 Patch available CNA
CPE configurations NVD · 2
| CPE | Versions | Role | Vendor |
|---|---|---|---|
| cpe:2.3:a:golang:go:*:*:*:*:*:*:*:* | before 1.19.10; 1.20.0 to before 1.20.5 | Vulnerable | Go standard library |
| cpe:2.3:o:fedoraproject:fedora:38:*:*:*:*:*:*:* | 38 | Vulnerable | Fedoraproject |
- cpe:2.3:a:golang:go:*:*:*:*:*:*:*:* Versions before 1.19.10; 1.20.0 to before 1.20.5 Vulnerable ·Go standard library
- cpe:2.3:o:fedoraproject:fedora:38:*:*:*:*:*:*:* Versions 38 Vulnerable ·Fedoraproject
Remediation
- Fix · CNA cmd/go (Go toolchain) Fixed in 1.19.10, 1.20.5
Red Hat 4 advisories
- RHSA-2024:4119 Released 2024-06-26 · Red Hat rating ImportantUpdated rhceph-5.3 container image and security update
- Red Hat Ceph Storage 5.3 Tools rhceph/keepalived-rhel8, rhceph/rhceph-5-dashboard-rhel8, rhceph/rhceph-5-rhel8 +2
- RHSA-2023:3923 Released 2023-06-29 · Red Hat rating Criticalgo-toolset and golang security update
- Red Hat Enterprise Linux AppStream (v. 9) go-toolset-1.19.10-1.el9_2, golang-1.19.10-1.el9_2, golang-bin-1.19.10-1.el9_2 +5
- RHSA-2023:3922 Released 2023-06-29 · Red Hat rating Criticalgo-toolset:rhel8 security update
- Red Hat Enterprise Linux AppStream (v. 8) delve-1.9.1-1.module+el8.8.0+16778+5fbb74f5.src::go-toolset:rhel8, delve-1.9.1-1.module+el8.8.0+16778+5fbb74f5.x86_64::go-toolset:rhel8, go-toolset-1.19.10-1.module+el8.8.0+19203+782922b7.aarch64::go-toolset:rhel8 +18
Show 1 more Red Hat advisories
- RHSA-2023:3920 Released 2023-06-29 · Red Hat rating Criticalgo-toolset-1.19 and go-toolset-1.19-golang security update
- Red Hat Developer Tools for Red Hat Enterprise Linux Server (v. 7) go-toolset-1.19-1.19.10-1.el7_9, go-toolset-1.19-build-1.19.10-1.el7_9, go-toolset-1.19-golang-1.19.10-1.el7_9 +8
- Red Hat Developer Tools for Red Hat Enterprise Linux Workstation (v. 7) go-toolset-1.19-1.19.10-1.el7_9, go-toolset-1.19-build-1.19.10-1.el7_9, go-toolset-1.19-golang-1.19.10-1.el7_9 +8
Fixed in the same release
Records fixed by the same vendor advisory or release, as the CNA lists them.
- Release ·
Go toolchain cmd/go 1.19.10, 1.20.5
3 records Highest priority Priority MEDIUM 3 MEDIUM
Other records, highest priority first
- TI-2023-13785 Improper sanitization of LDFLAGS with embedded spaces in go command with cgo in cmd/goPriority MEDIUM 52
- TI-2023-13782 Code injection via go command with cgo in cmd/goPriority MEDIUM 52
Vendor assessments
Red Hat
Red Hat rating: Important. Red Hat's page for this CVE →
| Product | Status | Plan or fix |
|---|---|---|
| Red Hat Ceph Storage 3 | Affected | No fix planned: Will not fix |
| Red Hat Storage 3 | Affected | No fix planned: Will not fix |
| Red Hat Ceph Storage 5.3 Tools | Fixed | RHSA-2024:4119 |
| Red Hat Developer Tools for Red Hat Enterprise Linux Server (v. 7) | Fixed | RHSA-2023:3920 |
| Red Hat Developer Tools for Red Hat Enterprise Linux Workstation (v. 7) | Fixed | RHSA-2023:3920 |
| Red Hat Enterprise Linux AppStream (v. 8) | Fixed | RHSA-2023:3922 |
| Red Hat Enterprise Linux AppStream (v. 9) | Fixed | RHSA-2023:3923 |
Timeline
- 2026-10-02 Threatist record created from CVE-2023-29404
- 2026-10-03 Alias added: GHSA-888h-rm2r-vrc7
References
Patch 1
Advisory 1
Other 5
- https://go.dev/issue/60305
- https://groups.google.com/g/golang-announce/c/q5135a9d924/m/j0ZoAJOHAwAJ
- https://lists.fedoraproject.org/archives/list/[email protected]/message/XBS3IIK6ADV24C5ULQU55QLT2UE762ZX/
- https://lists.fedoraproject.org/archives/list/[email protected]/message/NZ2O6YCO2IZMZJELQGZYR2WAUNEDLYV6/
- https://security.gentoo.org/glsa/202311-09
More Go standard library Go vulnerabilities
- TI-2020-00578 Improper certificate validation in Microsoft Windows KEVCVSS 3.1HIGH 8.1
- TI-2023-23979 The HTTP/2 protocol allows a denial of service (server resource consumption) because… KEVCVSS 3.1HIGH 7.5
- TI-2018-05208 The "go get" implementation in Go 1.9.4, when the -insecure command-line option is used… CVSS 3.1HIGH 8.8
- TI-2018-12083 Improper input validation in [UNKNOWN] golang CVSS 3.1HIGH 8.1
- TI-2024-16306 Mishandling of corrupt central directory record in archive/zip CVSS 3.1MEDIUM 5.5
- TI-2021-15910 Go before 1.16.9 and 1.17.x before 1.17.2 has a Buffer Overflow via large arguments in a… CVSS 3.1CRITICAL 9.8
Sources
- CVE-2023-29404 · CVE Program
- CVE-2023-29404 · NVD
- FIRST EPSS
- GHSA-888h-rm2r-vrc7 · GitHub Advisory Database · CC BY 4.0
- CVE-2023-29404 · Red Hat security data · CC BY 4.0
This product uses the NVD API but is not endorsed or certified by the NVD. Sources and licences