The SentinelOne Annual Threat Report - A Defenders Guide from the FrontlinesThe SentinelOne Annual Threat ReportGet the Report
Experiencing a Breach?Blog
Get StartedContact Us
SentinelOne
  • Platform
    Platform Overview
    • Singularity Platform
      Welcome to Integrated Enterprise Security
    • AI for Security
      Leading the Way in AI-Powered Security Solutions
    • Securing AI
      Accelerate AI Adoption with Secure AI Tools, Apps, and Agents.
    • How It Works
      The Singularity XDR Difference
    • Singularity Marketplace
      One-Click Integrations to Unlock the Power of XDR
    • Pricing & Packaging
      Comparisons and Guidance at a Glance
    Data & AI
    • Purple AI
      Accelerate SecOps with Generative AI
    • Singularity Hyperautomation
      Easily Automate Security Processes
    • AI-SIEM
      The AI SIEM for the Autonomous SOC
    • AI Data Pipelines
      Security Data Pipeline for AI SIEM and Data Optimization
    • Singularity Data Lake
      AI-Powered, Unified Data Lake
    • Singularity Data Lake for Log Analytics
      Seamlessly Ingest Data from On-Prem, Cloud or Hybrid Environments
    Endpoint Security
    • Singularity Endpoint
      Autonomous Prevention, Detection, and Response
    • Singularity XDR
      Native & Open Protection, Detection, and Response
    • Singularity RemoteOps Forensics
      Orchestrate Forensics at Scale
    • Singularity Threat Intelligence
      Comprehensive Adversary Intelligence
    • Singularity Vulnerability Management
      Application & OS Vulnerability Management
    • Singularity Identity
      Identity Threat Detection and Response
    Cloud Security
    • Singularity Cloud Security
      Block Attacks with an AI-Powered CNAPP
    • Singularity Cloud Native Security
      Secure Cloud and Development Resources
    • Singularity Cloud Workload Security
      Real-Time Cloud Workload Protection Platform
    • Singularity Cloud Data Security
      AI-Powered Threat Detection for Cloud Storage
    • Singularity Cloud Security Posture Management
      Detect and Remediate Cloud Misconfigurations
    Securing AI
    • Prompt Security
      Secure AI Tools Across Your Enterprise
  • Why SentinelOne?
    Why SentinelOne?
    • Why SentinelOne?
      Cybersecurity Built for What’s Next
    • Our Customers
      Trusted by the World’s Leading Enterprises
    • Industry Recognition
      Tested and Proven by the Experts
    • About Us
      The Industry Leader in Autonomous Cybersecurity
    Compare SentinelOne
    • Arctic Wolf
    • Broadcom
    • CrowdStrike
    • Cybereason
    • Microsoft
    • Palo Alto Networks
    • Sophos
    • Splunk
    • Trellix
    • Trend Micro
    • Wiz
    Verticals
    • Energy
    • Federal Government
    • Finance
    • Healthcare
    • Higher Education
    • K-12 Education
    • Manufacturing
    • Retail
    • State and Local Government
  • Services
    Managed Services
    • Managed Services Overview
      Wayfinder Threat Detection & Response
    • Threat Hunting
      World-Class Expertise and Threat Intelligence
    • Managed Detection & Response
      24/7/365 Expert MDR Across Your Entire Environment
    • Incident Readiness & Response
      DFIR, Breach Readiness, & Compromise Assessments
    Support, Deployment, & Health
    • Technical Account Management
      Customer Success with Personalized Service
    • SentinelOne GO
      Guided Onboarding & Deployment Advisory
    • SentinelOne University
      Live and On-Demand Training
    • Services Overview
      Comprehensive Solutions for Seamless Security Operations
    • SentinelOne Community
      Community Login
  • Partners
    Our Network
    • MSSP Partners
      Succeed Faster with SentinelOne
    • Singularity Marketplace
      Extend the Power of S1 Technology
    • Cyber Risk Partners
      Enlist Pro Response and Advisory Teams
    • Technology Alliances
      Integrated, Enterprise-Scale Solutions
    • SentinelOne for AWS
      Hosted in AWS Regions Around the World
    • Channel Partners
      Deliver the Right Solutions, Together
    • SentinelOne for Google Cloud
      Unified, Autonomous Security Giving Defenders the Advantage at Global Scale
    • Partner Locator
      Your Go-to Source for Our Top Partners in Your Region
    Partner Portal→
  • Resources
    Resource Center
    • Case Studies
    • Data Sheets
    • eBooks
    • Reports
    • Videos
    • Webinars
    • Whitepapers
    • Events
    View All Resources→
    Blog
    • Feature Spotlight
    • For CISO/CIO
    • From the Front Lines
    • Identity
    • Cloud
    • macOS
    • SentinelOne Blog
    Blog→
    Tech Resources
    • SentinelLABS
    • Ransomware Anthology
    • Cybersecurity 101
  • About
    About SentinelOne
    • About SentinelOne
      The Industry Leader in Cybersecurity
    • Investor Relations
      Financial Information & Events
    • SentinelLABS
      Threat Research for the Modern Threat Hunter
    • Careers
      The Latest Job Opportunities
    • Press & News
      Company Announcements
    • Cybersecurity Blog
      The Latest Cybersecurity Threats, News, & More
    • FAQ
      Get Answers to Our Most Frequently Asked Questions
    • DataSet
      The Live Data Platform
    • S Foundation
      Securing a Safer Future for All
    • S Ventures
      Investing in the Next Generation of Security, Data and AI
  • Pricing
Get StartedContact Us
CVE Vulnerability Database
Vulnerability Database/CVE-2024-24787

CVE-2024-24787: Go CGO Darwin Build RCE Vulnerability

CVE-2024-24787 is a remote code execution vulnerability affecting Go modules with CGO on Darwin systems using Apple's ld linker. This article covers the technical details, affected versions, security impact, and mitigation.

Updated: January 22, 2026

CVE-2024-24787 Overview

CVE-2024-24787 is an arbitrary code execution vulnerability affecting the Go programming language on Darwin (macOS) systems. When building a Go module that contains CGO code, an attacker can trigger arbitrary code execution through the exploitation of the -lto_library flag in a #cgo LDFLAGS directive when using Apple's version of the linker (ld).

This vulnerability affects developers building Go modules with CGO on macOS systems, potentially allowing malicious code execution during the build process itself. The attack requires local access and specific conditions to be exploited, but represents a significant supply chain risk for development environments.

Critical Impact

Building untrusted Go modules containing CGO on Darwin systems can lead to arbitrary code execution during the compilation process, potentially compromising developer workstations and CI/CD pipelines.

Affected Products

  • Go programming language (versions prior to patch)
  • macOS/Darwin systems using Apple's ld linker
  • Development environments building CGO-enabled Go modules

Discovery Timeline

  • 2024-05-08 - CVE-2024-24787 published to NVD
  • 2024-11-21 - Last updated in NVD database

Technical Details for CVE-2024-24787

Vulnerability Analysis

This vulnerability resides in Go's handling of CGO linker flags on Darwin systems. CGO enables Go packages to call C code, requiring interaction with the system's C compiler and linker. When building Go modules that utilize CGO, the Go toolchain processes #cgo LDFLAGS directives that specify linker flags.

On macOS, Apple's linker supports the -lto_library flag for Link-Time Optimization (LTO). The vulnerability arises because this flag can be abused within CGO directives to specify arbitrary library paths, leading to the loading and execution of malicious code during the link phase of compilation.

The local attack vector means an attacker must have some level of access to introduce malicious Go modules into a build environment, but this is common in supply chain attack scenarios where developers clone and build third-party code.

Root Cause

The root cause lies in insufficient validation and sanitization of the -lto_library flag when processed through CGO's LDFLAGS directive on Darwin systems. The Go toolchain did not adequately restrict or validate the paths specified via this flag, allowing an attacker to point to a malicious library that gets loaded during the linking phase.

This represents an input validation vulnerability where untrusted input (the -lto_library path in a module's CGO directive) is passed to a security-sensitive operation (the linker) without proper sanitization.

Attack Vector

The attack leverages the build process as the execution vector. An attacker crafts a malicious Go module containing a #cgo LDFLAGS directive that specifies the -lto_library flag pointing to attacker-controlled code. When a victim attempts to build this module on a Darwin system using Apple's linker, the malicious library is loaded and executed with the privileges of the user running the build.

This attack is particularly dangerous in scenarios involving:

  • Developers building third-party Go modules
  • CI/CD pipelines that automatically build Go dependencies
  • Development environments that process untrusted code

The vulnerability mechanism involves the -lto_library linker flag being processed without adequate path restrictions. When a malicious Go module includes a CGO directive such as #cgo LDFLAGS: -lto_library=/path/to/malicious/library, the Apple linker loads and executes code from the specified path during the build process. Technical details are available in the Go.dev Issue Tracker and the Go.dev Change List.

Detection Methods for CVE-2024-24787

Indicators of Compromise

  • Unexpected -lto_library flags in Go module source files or build logs
  • Suspicious paths referenced in #cgo LDFLAGS directives pointing to non-standard locations
  • Build processes attempting to load libraries from temporary or user-writable directories
  • Unusual network activity or file system modifications during Go build operations

Detection Strategies

  • Audit Go modules for suspicious #cgo LDFLAGS directives containing -lto_library flags
  • Implement source code scanning to detect potentially malicious CGO directives before building
  • Monitor build logs for unusual linker flag usage, particularly on Darwin systems
  • Use SentinelOne's endpoint detection to identify anomalous process behavior during compilation

Monitoring Recommendations

  • Enable detailed logging for Go build processes to capture linker flag usage
  • Implement file integrity monitoring on development systems and CI/CD build agents
  • Deploy behavioral analysis to detect code execution originating from build processes
  • Monitor for attempts to write or modify files in locations specified by -lto_library flags

How to Mitigate CVE-2024-24787

Immediate Actions Required

  • Update Go to the latest patched version that addresses CVE-2024-24787
  • Audit existing Go modules and dependencies for suspicious CGO directives
  • Implement code review policies requiring inspection of CGO flags in third-party modules
  • Consider using isolated build environments (containers, VMs) for building untrusted code

Patch Information

The Go team has released a fix for this vulnerability. The patch addresses the improper handling of the -lto_library flag in CGO directives on Darwin systems. Details about the fix can be found in the Go.dev Change List and the official Go.dev Vulnerability Report. Additional security information is available from the NetApp Security Advisory.

Administrators should update their Go installations immediately and rebuild any modules that may have been built with vulnerable versions.

Workarounds

  • Avoid building untrusted Go modules containing CGO on Darwin systems until patched
  • Use the -ldflags build flag to explicitly override linker settings when building suspicious modules
  • Build Go modules in isolated environments such as Docker containers to limit potential impact
  • Review and whitelist acceptable CGO directives in your development policies
bash
# Configuration example
# Verify your Go version includes the security patch
go version

# Update Go to the latest version (example using Homebrew on macOS)
brew upgrade go

# For CI/CD environments, ensure pinned Go version includes the fix
# Check the Go vulnerability database for patched versions
go run golang.org/x/vuln/cmd/govulncheck@latest ./...

Disclaimer: This content was generated using AI. While we strive for accuracy, please verify critical information with official sources.

  • Vulnerability Details
  • TypeRCE

  • Vendor/TechApple

  • SeverityMEDIUM

  • CVSS Score6.4

  • EPSS Probability2.48%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:3.1/AV:L/AC:H/PR:H/UI:N/S:U/C:H/I:H/A:H
  • Impact Assessment
  • ConfidentialityHigh
  • IntegrityNone
  • AvailabilityHigh
  • Technical References
  • OpenWall Security Discussion

  • Go.dev Change List

  • Go.dev Issue Tracker

  • Go Announcements Group Post

  • Go.dev Vulnerability Report

  • NetApp Security Advisory
  • Related CVEs
  • CVE-2022-22587: Apple iPadOS RCE Vulnerability

  • CVE-2025-43236: macOS Use-After-Free Vulnerability

  • CVE-2025-43210: Apple Media Processing Buffer Overflow

  • CVE-2025-43202: Apple iOS/macOS Buffer Overflow Flaw
Default Legacy - Prefooter | Experience the World’s Most Advanced Cybersecurity Platform

Experience the World’s Most Advanced Cybersecurity Platform

See how our intelligent, autonomous cybersecurity platform can protect your organization now and into the future.

Try SentinelOne
  • Get Started
  • Get a Demo
  • Product Tour
  • Why SentinelOne
  • Pricing & Packaging
  • FAQ
  • Contact
  • Contact Us
  • Customer Support
  • SentinelOne Status
  • Language
  • Platform
  • Singularity Platform
  • Singularity Endpoint
  • Singularity Cloud
  • Singularity AI-SIEM
  • Singularity Identity
  • Singularity Marketplace
  • Purple AI
  • Services
  • Wayfinder TDR
  • SentinelOne GO
  • Technical Account Management
  • Support Services
  • Verticals
  • Energy
  • Federal Government
  • Finance
  • Healthcare
  • Higher Education
  • K-12 Education
  • Manufacturing
  • Retail
  • State and Local Government
  • Cybersecurity for SMB
  • Resources
  • Blog
  • Labs
  • Case Studies
  • Videos
  • Product Tours
  • Events
  • Cybersecurity 101
  • eBooks
  • Webinars
  • Whitepapers
  • Press
  • News
  • Ransomware Anthology
  • Company
  • About Us
  • Our Customers
  • Careers
  • Partners
  • Legal & Compliance
  • Security & Compliance
  • Investor Relations
  • S Foundation
  • S Ventures

©2026 SentinelOne, All Rights Reserved.

Privacy Notice Terms of Use

English