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

> An attacker can write arbitrary files to the system by exploiting the cgo pkg-config directive in Go source code during the build process.

- **Severity:** High 7.8 (`CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:H`)
- **Exploited in the wild:** Not known
- **Login needed:** Any signed-in user
- **Attackable:** Local or same network only
- **Victim action needed:** Not needed
- **Fix available:** Yes
- **Published:** 28 Jan 2026
- **Updated:** 10 Sep 2026
- **Also known as:** AZL-78935, AZL-98568, BELL-CVE-2025-61731, BIT-golang-2025-61731, CLEANSTART-2026-IF00623, CLEANSTART-2026-KO65183, CLEANSTART-2026-TP40136, CLEANSTART-2026-YN86317, CLSA-2026-1775040432, DEBIAN-CVE-2025-61731, ECHO-76a3-60b7-33e7, GHSA-xvqr-69v8-f3gv, GO-2026-4339, MINI-23p8-j89f-fq73, MINI-26pr-6m8v-ppwc, MINI-27w4-56w3-h4qx, MINI-282m-mj9r-mc5j, MINI-284f-x5g9-529p, MINI-2ccx-w9pj-9prf, MINI-2h3x-f52r-vpr7, MINI-2jf8-xq76-j3rq, MINI-2jjq-wg63-wvfr, MINI-2rj7-g3jw-gpch, MINI-2rq8-6g93-pcc2, MINI-2v2h-3x43-pwf8, MINI-2v33-mj9g-8mwm, MINI-2wpf-xx63-74pc, MINI-2wq7-3hmg-4hm8, MINI-2x42-vp4c-rpcc, MINI-2x8w-cpwg-vj73, MINI-2xqr-8g8w-76mw, MINI-326h-g8hm-crcg, MINI-3276-g6fr-p8w2, MINI-32m8-48vp-wf53, MINI-339v-2hhg-jgqv, MINI-344h-xxxc-95wh, MINI-3774-qx8x-fxv3, MINI-37jq-fqr7-mcw7, MINI-383m-5r59-9g6c, MINI-3982-wxpc-cvfp, MINI-3ch6-v747-g582, MINI-3cpq-2wjc-4j8m, MINI-3cq6-v44r-869p, MINI-3f29-v8vg-fhvp, MINI-3g6x-798v-hm6h, MINI-3gmx-g2jw-9fcv, MINI-3hw5-qgch-ghpm, MINI-3mrh-4vj3-fcx8, MINI-3p77-67vf-f4jm, MINI-3pmh-ff26-q63f, MINI-3q7p-j5q4-m76w, MINI-3qv8-qfq4-pcg3, MINI-3r6c-f439-f68q, MINI-3r9m-2xv3-w94j, MINI-3rff-jmfq-257r, MINI-3rxq-p7mc-fgm8, MINI-3vhx-3gg5-rh74, MINI-3w9g-9x9m-xw2h, MINI-3wjr-pc9g-v9hx, MINI-3xvj-hrxm-fw7w, MINI-42w4-q36v-x5xw, MINI-43h8-8j6q-p758, MINI-43r5-4848-j699, MINI-4426-rx7g-9994, MINI-44f4-2q9c-wq92, MINI-466f-gj6h-wc92, MINI-484w-f3q9-7fwr, MINI-4988-q48h-23qf, MINI-4f85-m5m9-7c2m, MINI-4gmr-fqcv-5q72, MINI-4h9c-7h3g-vvcv, MINI-4hmm-h77r-h5h5, MINI-4hmw-5j3f-wf6w, MINI-4jgq-gjvh-jfcw, MINI-4m6j-rpj4-vcxw, MINI-4mwr-wv3g-hpqw, MINI-4pf6-9676-3xpp, MINI-4prc-5pq4-fmhr, MINI-4r73-h7hr-7gx9, MINI-4v4m-jpw2-h2qm, MINI-4vw7-3v75-cxqj, MINI-4vwh-6rxv-4qmx, MINI-4w8c-q6qf-88p5, MINI-4xfr-4663-4536, MINI-52cf-xrv2-cxfh, MINI-52r2-xwf3-3c7j, MINI-5668-mmgp-gv4x, MINI-57q5-38gg-369r, MINI-5884-8hqj-7q82, MINI-5c2f-2f4v-76vj, MINI-5cjh-m7r4-x93g, MINI-5f3v-9fx9-cv4c, MINI-5fmg-6c6h-4524, MINI-5g93-hhqx-xcq3, MINI-5mjv-q49r-gc43, MINI-5mrp-w5jx-fc33, MINI-5q44-2f43-28jq, MINI-5x54-9g87-g9cm, MINI-62vh-fxxg-v5xj, MINI-6445-x55r-4v59, MINI-64h5-3h6g-vr4r, MINI-64rr-j69x-rcm6, MINI-64xh-q9cv-59jh, MINI-654h-39vm-jq87, MINI-66qp-5h4x-fxjv, MINI-66x7-9mh9-pv2j, MINI-675h-rr3q-v6c7, MINI-677j-87vm-88vf, MINI-692p-q2r2-75ww, MINI-699c-wr32-5jf9, MINI-69x4-v6w2-c8hp, MINI-6fwm-6xhc-vp36, MINI-6hmv-r448-hpv7, MINI-6hwj-hm9f-g2mc, MINI-6rw7-g26g-qx4g, MINI-6xx7-hx6x-qfqq, MINI-724c-548p-5r3x, MINI-73h2-3wch-f36m, MINI-74r5-qjc4-rcxm, MINI-75qj-8x86-c5mf, MINI-76jq-6vj8-vg6r, MINI-77fr-vqj3-4qj9, MINI-78hh-cp4g-6r8x, MINI-7f26-j58g-f4q7, MINI-7fg8-fmc9-wmh3, MINI-7g34-xw5q-jq2h, MINI-7hr4-ffgg-56f7, MINI-7jv6-958c-wch9, MINI-7jxj-2pg8-g288, MINI-7mw7-wx53-2fch, MINI-7p8q-pm27-j2h4, MINI-7prh-h5v9-gf3c, MINI-7qcq-fhwm-8qj2, MINI-7r88-q28c-4mqp, MINI-7rcf-v5xx-rrf2, MINI-7rwp-9p42-q4jv, MINI-82jj-5pj7-h223, MINI-82p7-rmcc-3hwm, MINI-837j-6w9w-9mrp, MINI-83hw-63mw-rmcv, MINI-8422-p6c9-r3j6, MINI-854v-7hf4-v65f, MINI-85pq-4cwh-v2rf, MINI-86f8-6prg-7mq8, MINI-874h-gc88-5x9p, MINI-88qj-wqxh-597j, MINI-88rx-x7x3-8fvw, MINI-88w2-7qqx-98cv, MINI-8cxq-qf47-cgpx, MINI-8g32-8977-qmjq, MINI-8g5h-gf89-qwj5, MINI-8h27-c25r-9grf, MINI-8hf5-hrpg-j77w, MINI-8mpf-c84f-4wgm, MINI-8p9q-v7vc-562x, MINI-8q23-m826-g9jp, MINI-8vjx-376g-vfmx, MINI-8w4v-x5mr-gqpv, MINI-8wpg-5vv3-hvq9, MINI-92pc-cc6p-v98v, MINI-9352-mrf5-mm69, MINI-949p-f2q7-4hvf, MINI-95g8-4cvf-pc43, MINI-95gx-f6vr-xr5p, MINI-9698-6vmr-33f9, MINI-97j5-m6h7-23x5, MINI-97x4-276p-j9v3, MINI-99xm-xgxj-gpwg, MINI-9fq6-v6xq-p6p6, MINI-9fwm-qp44-cfcf, MINI-9g8r-m59w-gq62, MINI-9gpq-m6r6-gpvc, MINI-9h37-rh5w-53mg, MINI-9jr3-jw65-5gm5, MINI-9mq9-xf9p-xq7h, MINI-9pg6-qh4v-pvfh, MINI-9pmp-xrpg-2qh9, MINI-9vhr-9fhh-q3qm, MINI-9w6f-h8w9-v8rj, MINI-9wrw-6995-gf46, MINI-9x9c-qx26-jvwf, MINI-c3g4-37fg-gqwm, MINI-c4c9-447g-v5vw, MINI-c4pg-24f6-qhwx, MINI-c4wm-q94p-793m, MINI-c624-7xrx-3j7q, MINI-c6ff-fq52-m6rv, MINI-c747-qgc4-chv5, MINI-c9cx-6xgv-79f6, MINI-cfxm-9g9v-5m5c, MINI-cg26-hcpm-76fx, MINI-cgm9-vrqr-c7gr, MINI-cgpq-4jh3-gprv, MINI-cgqj-mc6j-h7g5, MINI-cj4q-p35q-23gv, MINI-cm8w-8xj5-6f27, MINI-cm9f-xc9q-pcpq, MINI-cq5f-qxw6-g23p, MINI-cr25-6rwq-7575, MINI-crr2-xvvg-wcxj, MINI-crww-mf97-hjph, MINI-cvw3-ghj8-x4hv, MINI-cw27-8j9p-4xj4, MINI-cw57-24hh-5hjf, MINI-cx5v-w6v3-xgvj, MINI-cxp7-ffx8-vwfp, MINI-f3qq-mgpx-ghcf, MINI-f3rx-3xm4-qr79, MINI-f54p-378r-3pw5, MINI-f54r-w5g4-36gv, MINI-f7mc-j43c-j9p4, MINI-f7vx-f6j3-9mpp, MINI-f8gh-2qp5-v765, MINI-f8jh-376r-g7m6, MINI-ff6g-hqqq-gxc8, MINI-fgq6-vx79-3p25, MINI-fm26-fv99-c6r7, MINI-fmwq-rmq5-84jp, MINI-fpf9-h493-fvfq, MINI-fv88-7749-hm92, MINI-fw7v-pcv4-x7xg, MINI-fwp3-75pq-hj7c, MINI-fwr5-q8q9-cqf6, MINI-fxg2-jf7m-m8qh, MINI-fxx7-6r6c-q6rf, MINI-g276-3258-mxc7, MINI-g28v-p2qm-g822, MINI-g2f9-p5vh-h6fv, MINI-g3c5-3cvr-jp8m, MINI-g7rg-8472-fwj7, MINI-g8px-rw27-gvj2, MINI-g8qc-x79x-c36r, MINI-g94p-p26j-85gj, MINI-g966-9v35-pxc4, MINI-gcj7-4vhx-x4q6, MINI-gfxx-8gxm-j8h3, MINI-gg22-25gg-pvcf, MINI-ggr3-892m-6948, MINI-gh2v-hpfx-9mv9, MINI-ghx7-crxw-8w89, MINI-gj55-hxpg-gpf6, MINI-gpm6-qm5v-9vmq, MINI-gvqf-gggh-cw45, MINI-gwj5-fmjf-r349, MINI-gxc9-xm63-mrc7, MINI-h2c8-pf6p-3g5w, MINI-h432-x6jf-vr79, MINI-h45j-pg77-m34w, MINI-h49h-fc62-p3r3, MINI-h4c9-fj93-m675, MINI-h4vw-48f7-gxm8, MINI-h5pc-x923-vvc9, MINI-h6cc-48rc-q7wm, MINI-h78j-qqrr-3x44, MINI-h798-v9jg-fv4h, MINI-h7rp-g2c3-j748, MINI-h9mx-6v6f-7jx4, MINI-hc9q-wjfc-5844, MINI-hg4r-j634-rv6h, MINI-hh2x-388h-qrxw, MINI-hh93-3gxv-7r8x, MINI-hhmm-mq96-7j32, MINI-hmq4-g427-78qv, MINI-hvj4-w8wf-943x, MINI-hvwm-8mvw-9965, MINI-hxmc-hvc7-8546, MINI-j223-jwhh-cw6r, MINI-j22w-gh8c-xr6f, MINI-j272-45rf-87gj, MINI-j2hf-5gjp-rhq3, MINI-j2pf-rmv6-26g3, MINI-j5x6-w7v4-4m4f, MINI-j62m-3r7q-7v48, MINI-j7mh-34hq-49q2, MINI-j877-mrq3-mqf3, MINI-j8wq-f3g5-mrj4, MINI-jc3m-x48q-phq8, MINI-jcqm-vcmm-3q78, MINI-jfc6-pqpw-r652, MINI-jfgx-87rf-rqvm, MINI-jgmf-9x2j-mv8w, MINI-jgwm-p652-wpvj, MINI-jjg7-mwph-3qc7, MINI-jp6p-j7hx-6mg8, MINI-jpj2-278p-p3qx, MINI-jqmr-9x6x-w3q4, MINI-jrr3-6697-vcmj, MINI-jwpj-gqv6-w3fp, MINI-jx72-xrrm-gm2w, MINI-jxg9-3xf4-7hrj, MINI-jxxc-mxgf-pfx6, MINI-m2w3-jq2r-62hj, MINI-m2wj-4rhp-v92r, MINI-m355-g22f-x2r8, MINI-m42g-hjp5-rjgj, MINI-m4jc-5vc4-54x8, MINI-m5rc-g39x-576x, MINI-m75p-wg6j-mp95, MINI-m874-g4r2-fv96, MINI-m9f8-j4wc-xfcg, MINI-mhw8-pvx3-hxfw, MINI-mhwj-q4m2-jfxq, MINI-mjv9-gxxh-2p5q, MINI-mm33-gvr6-9rw8, MINI-mmgm-vhwr-gmg5, MINI-mp5c-8ffc-r347, MINI-mr4h-245r-45f7, MINI-mx9c-5v69-pg39, MINI-p263-rqx8-w944, MINI-p2wv-p72q-p7rc, MINI-p362-3749-3qfx, MINI-p37x-q4p7-qw4r, MINI-p3q6-p38j-hv3w, MINI-p4fq-fpx5-3h7v, MINI-p4q3-xrhg-chxq, MINI-p64j-p6qj-pjrc, MINI-p95f-3wx5-gq56, MINI-pgcj-p9r3-xm5q, MINI-pgvv-j2vr-8pfj, MINI-phr4-chv8-hcjg, MINI-pmfp-wfg7-3c7j, MINI-pmr6-m437-r36x, MINI-pmwh-q8hh-v44j, MINI-pp48-xpjh-24mx, MINI-pq95-jmcj-6ffc, MINI-prf7-pm4g-9ffq, MINI-prqh-gmgr-ch32, MINI-pw64-f7x9-624g, MINI-px3r-4f23-44c9, MINI-px44-qr7h-26jh, MINI-q2c5-qf4x-hgg4, MINI-q2qv-xjp9-6v23, MINI-q3hh-rfpj-f65w, MINI-q5vj-78pq-c684, MINI-q66c-6ppp-m3rq, MINI-q6fp-pxg9-mg7x, MINI-q6pw-pf35-92px, MINI-q7q5-p3vm-35r2, MINI-q8gq-fc8w-g4cr, MINI-q988-76w6-6jmg, MINI-qc85-j5cv-jm92, MINI-qcpq-wcw3-2rrx, MINI-qg39-px5w-3h3x, MINI-qj7j-c8x8-vf97, MINI-qmf7-c27v-7x2g, MINI-qmp6-xw7g-8mv6, MINI-qmq9-r7hf-qhf8, MINI-qp4m-mh72-xxv4, MINI-qpj7-pf99-9g8c, MINI-qqh3-xjw6-jm4m, MINI-qqrq-g4mc-vx42, MINI-qw8x-j6gc-x28c, MINI-qwgm-wm3x-vh96, MINI-qx5c-r66c-ppj5, MINI-qx8w-jxpp-3qx6, MINI-r2v5-5rpc-gx7x, MINI-r3h4-pr87-cpg5, MINI-r57p-wwgp-vm6q, MINI-r65c-79mh-x5h5, MINI-r6jp-6fx4-x562, MINI-r6p8-2gq5-fcwq, MINI-r6x6-79hv-58cj, MINI-r7j5-vh2p-465v, MINI-r82h-7wxx-3c93, MINI-r84v-498h-6qhc, MINI-r89g-g3wf-5mvx, MINI-r8x8-w695-7v4c, MINI-r93g-3qpm-gghx, MINI-rccg-j865-4hf8, MINI-rg3p-43xv-73gq, MINI-rg48-3wqr-g786, MINI-rg5f-wcq9-pw6w, MINI-rgm5-3pxc-jg79, MINI-rjjg-mgm6-63f6, MINI-rmvv-rvgc-4ghf, MINI-rpjr-ccg8-ppj5, MINI-rq2m-5wcp-rj6v, MINI-rq7g-pvcr-fwmh, MINI-rqjp-jm3h-32qc, MINI-rvw7-jpcf-94pj, MINI-v3gq-7955-8783, MINI-v47g-m969-3fx8, MINI-v5hw-mvh6-x278, MINI-v5v8-w9g5-8h85, MINI-v626-648f-6frv, MINI-v67g-w83g-964g, MINI-v87g-cqx5-c2vf, MINI-v978-vp4x-2v9g, MINI-vf7q-xh77-4236, MINI-vg56-29g4-phq7, MINI-vh4r-66j3-v255, MINI-vh6c-2xqr-288x, MINI-vpgr-g4fm-2288, MINI-vpj4-w66w-gffv, MINI-vpjw-286m-jcfx, MINI-vpv8-mp3w-2gcx, MINI-vr52-pj56-f3w7, MINI-vvfj-hq29-mc7h, MINI-vwcf-cjhm-65fj, MINI-w3gr-j268-hh7q, MINI-w448-7r3m-p692, MINI-w58h-v5rv-7f9v, MINI-w5fx-25x8-cwq9, MINI-w5xg-f364-6q2g, MINI-w675-m4w6-2ghp, MINI-w6gm-hjg6-4h65, MINI-w6xr-g4gg-wj8f, MINI-w74v-vcfm-h3v4, MINI-w8pf-fpr6-v93c, MINI-w94j-25xp-jv23, MINI-wc63-pg2c-m222, MINI-wcjw-qm6m-992p, MINI-wfrr-x9gw-279v, MINI-wfx9-pvmh-gqpm, MINI-wgxg-8p5g-c6qf, MINI-wj39-839f-f2j2, MINI-wjvp-4j5j-hj9j, MINI-wmm6-fhj5-r2hg, MINI-wqr4-3c58-x6gv, MINI-wr85-m7gf-cr3r, MINI-x352-c9w9-799j, MINI-x3c8-2fwg-6wr6, MINI-x3ff-h5w8-p78c, MINI-x3mg-jxqg-jhv3, MINI-x3r8-g753-9hgp, MINI-x3x9-52xq-6gvh, MINI-x4hw-xr4q-hrpv, MINI-x539-g895-3qrf, MINI-x68w-jrr5-9x4q, MINI-x8m2-3fg2-vqc3, MINI-x9wf-vx4h-2fqw, MINI-xffc-4cr5-6qv6, MINI-xh8w-5vm3-76p3, MINI-xjcx-pm64-qrhp, MINI-xpvr-gq39-68qw, MINI-xqh3-jm4j-66ch, MINI-xqx3-45qr-hhqx, MINI-xvvw-6pg6-953q, MINI-xw47-pq7q-mqcr, ROOT-OS-DEBIAN-13-CVE-2025-61731, UBUNTU-CVE-2025-61731

## What is CVE-2025-61731?

CVE-2025-61731 is a high-severity path traversal vulnerability in Golang Go, published on 28 Jan 2026. It can only be exploited from the same machine or local network, with no action from the victim.

### Official description

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.

Weakness: CWE-88 (Improper Neutralization of Argument Delimiters in a Command)

## Which versions are affected by CVE-2025-61731?

2 open source packages ship an affected version, including golang and toolchain. It affects 1 product.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `golang` | Bitnami | All versions | 1.24.12, 1.25.6 |
| `toolchain` | Go | All versions | 1.24.12, 1.25.6 |

Products: Golang Go.

## How do I fix CVE-2025-61731?

Upgrade golang to a fixed version for your release line: 1.24.12 or 1.25.6.

## Is CVE-2025-61731 being exploited?

There is no known exploitation of CVE-2025-61731 in the wild and no public exploit code.

## Other vulnerabilities in Golang Go

- [CVE-2020-0601](https://insights.sbomify.com/CVE-2020-0601/): Microsoft Windows CryptoAPI Spoofing (high 8.1, exploited in the wild)
- [CVE-2026-27143](https://insights.sbomify.com/CVE-2026-27143/): Missing bound checks can lead to memory corruption in safe Go in cmd/compile (critical 9.8)
- [CVE-2024-24790](https://insights.sbomify.com/CVE-2024-24790/): Unexpected behavior from Is methods for IPv4-mapped IPv6 addresses in net/netip (critical 9.8)
- [CVE-2023-39320](https://insights.sbomify.com/CVE-2023-39320/): Arbitrary code execution via go.mod toolchain directive in cmd/go (critical 9.8)
- [CVE-2023-24540](https://insights.sbomify.com/CVE-2023-24540/): Improper handling of JavaScript whitespace in html/template (critical 9.8)

## Fix prompt for AI coding agents

```text
Check this codebase for CVE-2025-61731 and fix it if it is affected.

What it is: CVE-2025-61731 is a high-severity path traversal vulnerability in Golang Go, published on 28 Jan 2026. It can only be exploited from the same machine or local network, with no action from the victim.
Exploitation: There is no known exploitation of CVE-2025-61731 in the wild and no public exploit code.

Affected packages and fixed versions:
- golang (Bitnami): affected all versions; fixed in 1.24.12, 1.25.6
- toolchain (Go): affected all versions; fixed in 1.24.12, 1.25.6

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/CVE-2025-61731/ (Markdown: https://insights.sbomify.com/CVE-2025-61731/index.md)
```

## Sources

- CVE record: https://www.cve.org/CVERecord?id=CVE-2025-61731
- NVD: https://nvd.nist.gov/vuln/detail/CVE-2025-61731
- OSV: https://osv.dev/vulnerability/CVE-2025-61731

---
From sbomify Insights: https://insights.sbomify.com/CVE-2025-61731/
Summaries are generated and may contain mistakes; the official description above is the record.
