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
    • 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-2025-61731

CVE-2025-61731: Go cmd/go Path Traversal Vulnerability

CVE-2025-61731 is a path traversal vulnerability in Go's cmd/go that lets attackers write to controlled files via malicious pkg-config directives. This article covers technical details, affected versions, impact, and mitigation.

Published: January 30, 2026

CVE-2025-61731 Overview

CVE-2025-61731 is an Arbitrary File Write vulnerability affecting the Go programming language's cmd/go build tool. The vulnerability exists in how the #cgo pkg-config: directive processes command-line arguments. An attacker can craft a malicious Go source file containing a specially crafted cgo directive that injects a --log-file argument, causing pkg-config to write content to an attacker-controlled location on the filesystem.

Critical Impact

Attackers can achieve arbitrary file writes with partial content control by building malicious Go source files, potentially leading to code execution, configuration tampering, or privilege escalation.

Affected Products

  • Go programming language (cmd/go build tool)
  • Systems building untrusted Go source code with cgo enabled
  • CI/CD pipelines processing external Go dependencies

Discovery Timeline

  • 2026-01-28 - CVE-2025-61731 published to NVD
  • 2026-01-29 - Last updated in NVD database

Technical Details for CVE-2025-61731

Vulnerability Analysis

This vulnerability represents an input validation failure in the Go build system's handling of cgo directives. When processing Go source files that contain #cgo pkg-config: directives, the cmd/go tool passes the directive contents as command-line arguments to the system's pkg-config utility without adequate sanitization.

The fundamental issue is that pkg-config accepts a --log-file argument that instructs it to write output to a specified file path. Since the cgo directive allows arbitrary arguments to be passed through, an attacker can inject --log-file=/path/to/target to cause writes to arbitrary filesystem locations during the build process.

This attack requires local access, as the attacker must convince a user or build system to compile malicious Go source code. However, in modern development workflows involving automated dependency management and CI/CD pipelines, untrusted code may be built automatically, significantly expanding the attack surface.

Root Cause

The root cause is insufficient input validation and argument filtering in the cmd/go tool when processing #cgo pkg-config: directives. The implementation fails to sanitize or restrict dangerous command-line arguments before passing them to the external pkg-config process. This allows attackers to abuse pkg-config's legitimate logging functionality for malicious file write operations.

Attack Vector

The attack requires local access and involves creating a malicious Go source file with a specially crafted cgo directive. When a victim builds this file using go build or similar commands, the injected --log-file argument causes pkg-config to write to an attacker-specified location.

The attack is particularly concerning in scenarios involving:

  • Building third-party or untrusted Go modules
  • CI/CD systems that automatically fetch and build dependencies
  • Development environments processing code from external sources

The attacker gains partial control over the file contents through pkg-config's log output, which may be sufficient for certain exploitation scenarios such as overwriting configuration files or injecting content into startup scripts.

Detection Methods for CVE-2025-61731

Indicators of Compromise

  • Unexpected files appearing in system directories or sensitive locations after Go build operations
  • Go source files containing suspicious #cgo pkg-config: directives with --log-file arguments
  • Unusual pkg-config process activity writing to non-standard locations
  • Modified configuration files or scripts with pkg-config log output artifacts

Detection Strategies

  • Scan Go source files and dependencies for #cgo pkg-config: directives containing --log-file or other dangerous arguments
  • Monitor file system activity during build operations for writes to unexpected locations
  • Implement build-time scanning that flags cgo directives with potentially malicious argument patterns
  • Review Go module dependencies for source files containing suspicious cgo configurations

Monitoring Recommendations

  • Enable audit logging for file creation events during CI/CD build processes
  • Monitor pkg-config process invocations for unusual command-line arguments
  • Implement integrity monitoring on critical system files that could be targeted by arbitrary write attacks
  • Track changes to Go source files in version control for newly introduced cgo directives

How to Mitigate CVE-2025-61731

Immediate Actions Required

  • Update to the latest patched version of Go as indicated in the Golang Announcement
  • Audit existing Go source files and dependencies for malicious #cgo pkg-config: directives
  • Review build environments to identify systems that may have processed untrusted Go code
  • Consider disabling cgo (CGO_ENABLED=0) for builds that don't require C interoperability

Patch Information

The Go team has addressed this vulnerability through code changes that sanitize pkg-config arguments. Technical details are available in the Go.dev Code Change and the Go.dev Issue Report. The official vulnerability advisory is published at Go.dev Vulnerability Advisory.

Organizations should update their Go installations to the latest patched version and rebuild any applications that may have been compiled with a vulnerable Go version using untrusted source code.

Workarounds

  • Set CGO_ENABLED=0 environment variable to disable cgo entirely for builds that don't require C library integration
  • Implement pre-build scanning to detect and block Go source files containing suspicious #cgo pkg-config: directives
  • Run build processes in isolated containers or sandboxed environments with restricted filesystem access
  • Manually review cgo directives in third-party dependencies before incorporating them into projects
bash
# Disable cgo to prevent pkg-config directive exploitation
export CGO_ENABLED=0
go build ./...

# Alternative: Build in a restricted environment
# Use containers with read-only filesystems where possible

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

  • Vulnerability Details
  • TypePath Traversal

  • Vendor/TechGo

  • SeverityHIGH

  • CVSS Score7.8

  • EPSS Probability0.01%

  • Known ExploitedNo
  • CVSS Vector
  • CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H
  • Impact Assessment
  • ConfidentialityLow
  • IntegrityNone
  • AvailabilityHigh
  • Technical References
  • Go.dev Code Change

  • Go.dev Issue Report

  • Golang Announcement

  • Go.dev Vulnerability Advisory
  • Related CVEs
  • CVE-2026-33252: Go MCP SDK CSRF Vulnerability

  • CVE-2026-27896: Go MCP SDK Auth Bypass Vulnerability

  • CVE-2025-4674: Go Command RCE Vulnerability in VCS

  • CVE-2023-24531: Go Environment Command RCE Vulnerability
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