CVE-2025-4674 Unexpected command execution in untrusted VCS repositories in cmd/go

High 8.6 Published Updated

The Go command may execute unexpected commands when operating in untrusted VCS repositories with dangerous configuration, allowing code execution.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Local or same network only
Victim action needed
A user has to click or open something
Fix
Available

What is CVE-2025-4674?

CVE-2025-4674 is a high-severity command injection vulnerability in Golang Go, published on 29 Jul 2025. It can only be exploited from the same machine or local network, and only if a user opens a file or follows a link.

Official description

The go command may execute unexpected commands when operating in untrusted VCS repositories. This occurs when possibly dangerous VCS configuration is present in repositories. This can happen when a repository was fetched via one VCS (e.g. Git), but contains metadata for another VCS (e.g. Mercurial). Modules which are retrieved using the go command line, i.e. via "go get", are not affected.

Weakness: CWE-73

Which versions are affected by CVE-2025-4674?

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

PackageAffectedFixed in
golang BitnamiAll versions1.23.11, 1.24.5
toolchain GoAll versions1.23.11, 1.24.5
Linux distribution packages (38)
delve AlmaLinux:8All versions1.24.1-1.module_el8.10.0+3977+66935a26
go-toolset AlmaLinux:8All versions1.24.6-1.module_el8.10.0+4033+4bf8b620
golang AlmaLinux:8All versions1.24.6-1.module_el8.10.0+4033+4bf8b620
golang-bin AlmaLinux:8All versions1.24.6-1.module_el8.10.0+4033+4bf8b620
golang-docs AlmaLinux:8All versions1.24.6-1.module_el8.10.0+4033+4bf8b620
golang-misc AlmaLinux:8All versions1.24.6-1.module_el8.10.0+4033+4bf8b620
golang-src AlmaLinux:8All versions1.24.6-1.module_el8.10.0+4033+4bf8b620
golang-tests AlmaLinux:8All versions1.24.6-1.module_el8.10.0+4033+4bf8b620
go-toolset AlmaLinux:9All versions1.24.6-1.el9_6
golang AlmaLinux:9All versions1.24.6-1.el9_6
golang-bin AlmaLinux:9All versions1.24.6-1.el9_6
golang-docs AlmaLinux:9All versions1.24.6-1.el9_6
golang-misc AlmaLinux:9All versions1.24.6-1.el9_6
golang-race AlmaLinux:9All versions1.24.6-1.el9_6
golang-src AlmaLinux:9All versions1.24.6-1.el9_6
golang-tests AlmaLinux:9All versions1.24.6-1.el9_6
delve Red Hat:enterprise_linux:8::appstreamAll versions0:1.24.1-1.module+el8.10.0+22945+b2c96a17
delve-debuginfo Red Hat:enterprise_linux:8::appstreamAll versions0:1.24.1-1.module+el8.10.0+22945+b2c96a17
delve-debugsource Red Hat:enterprise_linux:8::appstreamAll versions0:1.24.1-1.module+el8.10.0+22945+b2c96a17
go-toolset Red Hat:enterprise_linux:8::appstreamAll versions0:1.24.6-1.module+el8.10.0+23407+428597c7
golang Red Hat:enterprise_linux:8::appstreamAll versions0:1.24.6-1.module+el8.10.0+23407+428597c7
golang-bin Red Hat:enterprise_linux:8::appstreamAll versions0:1.24.6-1.module+el8.10.0+23407+428597c7
golang-docs Red Hat:enterprise_linux:8::appstreamAll versions0:1.24.6-1.module+el8.10.0+23407+428597c7
golang-misc Red Hat:enterprise_linux:8::appstreamAll versions0:1.24.6-1.module+el8.10.0+23407+428597c7
golang-src Red Hat:enterprise_linux:8::appstreamAll versions0:1.24.6-1.module+el8.10.0+23407+428597c7
golang-tests Red Hat:enterprise_linux:8::appstreamAll versions0:1.24.6-1.module+el8.10.0+23407+428597c7
delve Red Hat:rhel_e4s:8.8::appstreamAll versions0:1.9.1-1.module+el8.8.0+16778+5fbb74f5
delve-debuginfo Red Hat:rhel_e4s:8.8::appstreamAll versions0:1.9.1-1.module+el8.8.0+16778+5fbb74f5
delve-debugsource Red Hat:rhel_e4s:8.8::appstreamAll versions0:1.9.1-1.module+el8.8.0+16778+5fbb74f5
go-toolset Red Hat:rhel_e4s:8.8::appstreamAll versions0:1.19.13-3.module+el8.8.0+22903+37387f31
golang Red Hat:rhel_e4s:8.8::appstreamAll versions0:1.19.13-16.module+el8.8.0+23410+958e78d9
golang-bin Red Hat:rhel_e4s:8.8::appstreamAll versions0:1.19.13-16.module+el8.8.0+23410+958e78d9
golang-docs Red Hat:rhel_e4s:8.8::appstreamAll versions0:1.19.13-16.module+el8.8.0+23410+958e78d9
golang-misc Red Hat:rhel_e4s:8.8::appstreamAll versions0:1.19.13-16.module+el8.8.0+23410+958e78d9
golang-race Red Hat:rhel_e4s:8.8::appstreamAll versions0:1.19.13-16.module+el8.8.0+23410+958e78d9
golang-src Red Hat:rhel_e4s:8.8::appstreamAll versions0:1.19.13-16.module+el8.8.0+23410+958e78d9
golang-tests Red Hat:rhel_e4s:8.8::appstreamAll versions0:1.19.13-16.module+el8.8.0+23410+958e78d9
golang Red Hat:rhel_e4s:9.2::appstreamAll versions0:1.19.13-18.el9_2

Products include Golang Go.

How do I fix CVE-2025-4674?

Upgrade golang to a fixed version for your release line: 1.23.11 or 1.24.5.

Upgrade, and pass arguments to programs as a list instead of through a shell. More about Command injection.

Is CVE-2025-4674 being exploited?

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

All Golang Go vulnerabilities

Sources

Also known as ALSA-2025:13935, ALSA-2025:13940, AZL-66098, AZL-66101, BELL-CVE-2025-4674, BIT-golang-2025-4674 and 111 more.

Is CVE-2025-4674 in your software?

Upload an SBOM and sbomify checks it against every vulnerability here, every day.

Check your SBOMs for free