CVE-2025-61731: Arbitrary file write using cgo pkg-config directive in cmd/go

Published Jan 28, 2026
·
Updated

Building a malicious file with cmd/go can cause can cause a write to an attacker-controlled file with partial control of the file content. The "#cgo pkg-config:" directive in a Go source file provides command-line arguments to provide to the Go pkg-config command. An attacker can provide a "--log-file" argument to this directive, causing pkg-config to write to an attacker-controlled location.

Affected Software

3 affected components
go
Golang Go<1.24.12
Golang Go>=1.25.0<1.25.6

Event History

Jan 28, 2026
CVE Published
via MITRE·07:30 PM
Data Sourced
via MITRE·07:30 PM
DescriptionWeakness
Data Sourced
via Red Hat·08:02 PM
DescriptionSeverityAffected Software
Data Sourced
via NVD·08:16 PM
RemedyDescriptionSeverityWeaknessAffected Software
Jan 23, 58467
Event
via NVD·05:45 PM
Free Weekly Intel

Don't miss critical vulnerabilities

Join thousands of security professionals who receive our weekly digest of trending CVEs, zero-days, and exploited vulnerabilities.

No spam. Unsubscribe anytime.

Frequently Asked Questions

1

What is the severity of CVE-2025-61731?

CVE-2025-61731 is categorized as a high-severity vulnerability due to its potential for arbitrary file write exploitation.

2

How do I fix CVE-2025-61731?

To mitigate CVE-2025-61731, ensure that you avoid the use of the "#cgo pkg-config:" directive with untrusted inputs in your Go applications.

3

What types of files can be affected by CVE-2025-61731?

CVE-2025-61731 can lead to arbitrary file writes, impacting any file that an attacker can control if proper precautions are not taken.

4

Which versions of Go are affected by CVE-2025-61731?

CVE-2025-61731 affects versions of Go prior to the fix being applied in the upcoming updates.

5

Is CVE-2025-61731 considered a serious risk for production environments?

Yes, CVE-2025-61731 poses a serious risk in production environments as it allows for unauthorized file creation and potential code execution.

Contact

SecAlerts Pty Ltd.
132 Wickham Terrace
Fortitude Valley,
QLD 4006, Australia
info@secalerts.co
By using SecAlerts services, you agree to our services end-user license agreement. This website is safeguarded by reCAPTCHA and governed by the Google Privacy Policy and Terms of Service. All names, logos, and brands of products are owned by their respective owners, and any usage of these names, logos, and brands for identification purposes only does not imply endorsement. If you possess any content that requires removal, please get in touch with us.
© 2026 SecAlerts Pty Ltd.
ABN: 70 645 966 203, ACN: 645 966 203