CVE-2025-46816 goshs route not protected, allows command execution

Critical 9.4 Published Updated

Attackers can execute arbitrary commands on goshs servers via websockets when the server is run without specific arguments, bypassing intended restrictions.

Exploited in the wild
Not known
Login needed
Not needed
Attackable
Over the internet
Victim action needed
Not needed
Fix
Available

What is CVE-2025-46816?

CVE-2025-46816 is a critical command injection vulnerability in patrickhener goshs, published on 6 May 2025. An attacker can exploit it over the internet without logging in, with no action from the victim.

Official description

goshs is a SimpleHTTPServer written in Go. Starting in version 0.3.4 and prior to version 1.0.5, running goshs without arguments makes it possible for anyone to execute commands on the server. The function `dispatchReadPump` does not checks the option cli `-c`, thus allowing anyone to execute arbitrary command through the use of websockets. Version 1.0.5 fixes the issue.

Weakness: CWE-77, CWE-284

Which versions are affected by CVE-2025-46816?

3 open source packages ship an affected version, including github.com/patrickhener/goshs.

PackageAffectedFixed in
github.com/patrickhener/goshs GoFrom 0.3.41.0.5
github.com/patrickhener/goshs GoFrom 0.3.41.0.5
github.com/patrickhener/goshs GoFrom 0.3.41.0.5

How do I fix CVE-2025-46816?

Upgrade github.com/patrickhener/goshs to 1.0.5 or later.

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

Is CVE-2025-46816 being exploited?

It is not confirmed as exploited in the wild, but public exploit code for CVE-2025-46816 exists.

Public exploit code: 1 proofs of concept on GitHub.

Sources

Also known as GHSA-rwj2-w85g-5cmm, GO-2025-3672.

Is CVE-2025-46816 in your software?

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

Check your SBOMs for free