Skip to main content
Mallory
HighVulnerability

CVE-2025-61731: Arbitrary File Write via pkg-config Argument Injection in Go cmd/go

Published Jan 28, 2026 · Updated 2 days ago
Trending this weekNot trendingOutside this week’s top 100
Mention activity · 30 days3 mentions · peak 2 in a dayToday
CVSS8.6High · v3.1
EPSS0.49%35th percentile
CISA KEVNoNot listed
In the wildNoneNo exploitation reported
Vendor
Golang
IdentifiersCVE-2025-61731CWE-88 · Improper Neutralization of…

CVE-2025-61731 is an argument-injection vulnerability in Go's cmd/go build tooling. Arguments supplied through the #cgo pkg-config: directive are passed to pkg-config without sufficient allowlist validation. A malicious Go source file can supply the --log-file option to cause pkg-config to write to an attacker-selected location, with partial attacker control over the written content. Exploitation occurs during a build and can cause unauthorized file creation or modification, potentially leading to arbitrary code execution.

Do you run this?See affected versions in your environment and whether adversaries are exploiting this vulnerability against assets like yours.
Check your exposure
Analyst brief

Impact, mitigation & remediation

What it means and what to do now: patch path, interim mitigations, and the assume-compromise checklist.

Impact

What an attacker gets, and what they’ve been doing with it.

Successful exploitation compromises filesystem integrity under the permissions of the build process by writing partially attacker-controlled content to an attacker-selected location. Depending on the destination and subsequent use of the modified file, this may lead to arbitrary code execution. The primitive does not provide unrestricted control over the written content.

Mitigation

If you can’t patch tonight, do this now.

Avoid building untrusted Go source with vulnerable toolchains. Where compatible with the project, disable cgo using CGO_ENABLED=0. Otherwise, isolate builds in a sandbox with least-privilege filesystem access and restrict writes outside designated build directories. Monitor or reject unexpected pkg-config arguments, particularly --log-file.

Remediation

Patch, then assume compromise.

Upgrade the Go toolchain to Go 1.24.12, Go 1.25.6, or a later patched release. The fix sanitizes arguments arising from CgoPkgConfig before invoking pkg-config, preventing options outside the permitted allowlist. For vendor-distributed Go packages or bundled toolchains, apply the corresponding vendor security update.

Public exploits

Exploits

No public exploits tracked yet. Mallory keeps watching.

View more in app →
No public exploit code observed for this vulnerability. Mallory keeps watching.
Exposure surface

Affected products & vendors

Products and vendors Mallory has correlated with this vulnerability. Open in Mallory to drill down to specific CPE configurations and version ranges.

VendorProductType
GolangGoapplication
FAQ

Frequently asked questions

Is CVE-2025-61731 exploited in the wild?
As of Nov 23, 2026, Mallory has no reports of CVE-2025-61731 being exploited in the wild. It is not listed in CISA KEV.
Is there a public exploit for CVE-2025-61731?
As of Nov 23, 2026, Mallory has found no public exploit for CVE-2025-61731.
Is there a patch for CVE-2025-61731?
Upgrade the Go toolchain to Go 1.24.12, Go 1.25.6, or a later patched release. The fix sanitizes arguments arising from CgoPkgConfig before invoking pkg-config, preventing options outside the permitted allowlist.
What products are affected by CVE-2025-61731?
Golang Go.
How severe is CVE-2025-61731?
CVE-2025-61731 has a CVSS v3.1 score of 8.6 (High) and an EPSS score of 0.49% (35th percentile) as of Nov 23, 2026.
Activity feed

Recent activity

40 sources tracked across advisories, community write-ups, and news. New activity surfaces here as Mallory finds it.

View more in app →
golangNews · Nov 16, 2026[security] Go 1.25.6 and Go 1.24.12 are releasedA flag-sanitization bypass in Go's cmd/go permits CgoPkgConfig to invoke pkg-config with flags outside the explicit safe list, potentially leading to arbitrary code execution. Go 1.25.6 and 1.24.12 sanitize the resulting compiler flags before invoking pkg-config.Read more ↗golangNews · Nov 16, 2026[security] Go 1.25.6 and Go 1.24.12 are releasedA flag-sanitization bypass in Go's cmd/go permits CgoPkgConfig to invoke pkg-config with flags that are not explicitly allowlisted, potentially leading to arbitrary code execution. Go 1.25.6 and 1.24.12 sanitize the resulting compiler flags before invoking pkg-config.Read more ↗tenable nessus pluginsNews · Nov 3, 2026TencentOS Server 4: golang (TSSA-2026:0118) | Tenable®Building a malicious Go source file with cmd/go can cause a write to an attacker-selected file with partially attacker-controlled content through arguments supplied to pkg-config. The plugin reports exploit availability at the advisory level without explicitly identifying which listed vulnerabilities have exploits.Read more ↗tenable nessus pluginsNews · Oct 4, 2026AlmaLinux 9.2 [TuxCare] Security Update: go-toolset / golang /... | Tenable®Building malicious Go source with cmd/go can cause a file write to an attacker-controlled location with partial control over the content. The attacker supplies a --log-file argument through the #cgo pkg-config: directive. The advisory identifies affected Go packages on AlmaLinux 9.2 and assigns a CVSS v3 base score of 8.6. Nessus detects affected versions using self-reported version information rather than testing exploitation.Read more ↗
+4 more in the timeline. Sign up to see them
Do you run this?See affected versions in your environment and whether adversaries are exploiting this vulnerability against assets like yours.
Check your exposure
Mallory platform

The version that knows your environment.

This page is what’s public. Mallory adds the parts that aren’t: which of your assets are affected, which adversaries are exploiting it right now, and which detections to deploy tonight.
Exposure mappingQuery your assets running an affected version, and investigate the blast radius.
Threat actor evidenceEvery report linking this CVE to a named adversary.
Associated malwareMalware families linked to this CVE, with evidence and IOCs.
Detection signaturesYARA, Sigma, Snort, and vendor rules, auto-deployed to your SIEM.
Vendor-by-vendor mappingCross-references every affected SKU, including bundled OEM variants.
Social activity17Community discussion across Reddit, Mastodon, and other social sources.