CVE-2024-24787

published 8 May 2024 · updated 16 Nov 2026

Arbitrary code execution during build on Darwin in cmd/go

6.4MediumCVSS 6.4EPSS 1%

No exploitation in the wild has been reported. EPSS puts the chance of exploitation in the next 30 days at 1%. Fixed in 1.21.10 and 1.22.3.

On Darwin, building a Go module which contains CGO can trigger arbitrary code execution when using the Apple version of ld, due to usage of the -lto_library flag in a "#cgo LDFLAGS" directive.

Affected

Vendors, products and packages with version ranges

VendorProductVersionsFixed
Go toolchain<1.21.10, >=1.22.0-0 <1.22.31.21.10, 1.22.3

Timeline

Every event on this vulnerability

Embed

A live severity badge for an advisory, README or ticket

CVE-2024-24787 severity on Zeptric[![CVE-2024-24787](https://zeptric.io/badge/cve/CVE-2024-24787.svg)](https://zeptric.io/cve/CVE-2024-24787)