CVE-2022-30580: Empty Cmd.Path can trigger unintended binary in os/exec on Windows

stdlib Updated 02 Oct 2025

Summary

26/07/2022
Yes i
Unrated
Not published

CVE-2022-30580: Empty Cmd.Path can trigger unintended binary in os/exec on Windows. Affects stdlib across 2 version ranges.

< 1.17.11 >= 1.18.0-0, < 1.18.3

Fixed in 1.17.11 or 1.18.3, depending on the release line you run. How to fix ↓

Also tracked for

The same CVE-2022-30580 is tracked separately for each ecosystem and vendor. Its fix information is the same; the package and affected versions differ.

Free scan

Check if this vulnerability affects your application

Upload a manifest or SBOM and we'll show whether you're affected, plus every other risky package in the same scan.

Check my app free

No signup required · Results in about 60 seconds

Sponsored MarkAI Find prospects already talking about the problem you solve AI watches the communities your customers use to find qualified prospects, then alerts you when a conversation is worth joining. See MarkAI

Background

The stdlib package in the Go ecosystem provides a set of standard libraries for the Go programming language. One of the packages in stdlib is os/exec, which allows the execution of external commands. This vulnerability affects the os/exec package on Windows systems. The package provides functionality to run commands and retrieve their output, but when the Cmd.Path is unset, it can unintentionally execute binaries in the working directory named either "..com" or "..exe".

Vulnerability Detail

The vulnerability arises when using the Cmd.Run, Cmd.Start, Cmd.Output, or Cmd.CombinedOutput functions in the os/exec package on Windows. If the Cmd.Path is not set, it will default to an empty value. This can lead to unintended execution of binaries in the working directory that have names ending in ".com" or ".exe". An attacker could place a malicious binary with such a name in the working directory and trick the application into executing it. This could result in arbitrary code execution with the privileges of the application.

How To Fix

Latest published version: go1.25.5 as of 22 Oct 2026

go get stdlib@vgo1.25.5

Upgrading to it may include breaking changes; the versions below are the minimum fixed release for this vulnerability.

If you can't move to the latest

The minimum fixed version depends on the release line you run.

  • < 1.17.11 1.17.11
    go get stdlib@v1.17.11
  • >= 1.18.0-0, < 1.18.3 1.18.3
    go get stdlib@v1.18.3

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Workaround

As a workaround, developers can explicitly set the Cmd.Path to a valid executable path before calling the affected functions. By ensuring that the Cmd.Path is always set to a trusted and expected value, the vulnerability can be mitigated. Here is an example of how to set the Cmd.Path:

package main

import (
	"os/exec"
	"fmt"
)

func main() {
	cmd := exec.Command("C:\\path\\to\\executable.exe")
	// Rest of the code
}

Conclusion

The CVE-2022-30580 vulnerability in the Go stdlib package's os/exec package on Windows systems allows unintended execution of binaries in the working directory. This can result in arbitrary code execution with the application's privileges. It is crucial to update the Go stdlib package to versions 1.17.11 or 1.18.3 to mitigate this vulnerability. Alternatively, developers can set the Cmd.Path explicitly to a trusted executable path as a temporary workaround. For further assistance with vulnerability remediation, contact DevNack.com.

See every vulnerability recorded for stdlib →

Share this vulnerability

FAQ

This vulnerability can lead to arbitrary code execution with the privileges of the application. An attacker could place a malicious binary in the working directory and trick the application into executing it.

Versions 0.0.0 to 1.17.10 and 1.18.0-0 to 1.18.2 of the Go stdlib package are affected.

No, this vulnerability only affects Windows systems.

Yes, updating the Go stdlib package to version 1.17.11 or 1.18.3 will fix this vulnerability.

As a temporary workaround, you can explicitly set the Cmd.Path to a valid executable path before calling the affected functions.

Related vulnerabilities

Recent vulnerabilities recorded for stdlib.

How To Fix

Latest published version: go1.25.5 as of 22 Oct 2026

go get stdlib@vgo1.25.5

Upgrading to it may include breaking changes; the versions below are the minimum fixed release for this vulnerability.

If you can't move to the latest

The minimum fixed version depends on the release line you run.

  • < 1.17.11 1.17.11
    go get stdlib@v1.17.11
  • >= 1.18.0-0, < 1.18.3 1.18.3
    go get stdlib@v1.18.3

Tip — Not sure which release line you're on? Vulert can find the fix for the version you are using. Scan free →

Subscribe to Vulert on Telegram
Daily digest of new CVEs, critical and high severity, affected packages and fixes — plus a weekly roundup.
Join the channel →
Help improve this record
Report an issue or send feedback