GitHub Advisoryadvisory · Go

GHSA-rwj2-w85g-5cmm goshs route not protected, allows command execution

CRITICAL Published 2025-05-06 Modified 2025-05-06 Official page ↗
Aliases
CVE-2025-46816
Ecosystem
Go
Packages
github.com/patrickhener/goshs
Severity
Critical
CVSS vector
CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:L
Weaknesses
CWE-284, CWE-77
Reviewed
2025-05-06

Affected packages

• Go github.com/patrickhener/goshs: >= 0.3.4, < 1.0.5 → fixed in 1.0.5

Description

Summary It seems that when running goshs without arguments it is possible for anyone to execute commands on the server. This was tested on version 1.0.4 of goshs. The command function was introduced in version 0.3.4. Details It seems that the function ```dispatchReadPump``` does not checks the option cli ```-c```, thus allowing anyone to execute arbitrary command through the use of websockets. PoC Used websocat for the POC: ```bash echo -e '{"type": "command", "content": "id"}' |./websocat 'ws://192.168.1.11:8000/?ws' -t ``` Impact The vulnerability will only impacts goshs server on vulnerable versions.

Related

Alias · CVE (1)

  • CVE-2025-46816 goshs is a SimpleHTTPServer written in Go. vulnerability

Weakness · CWE (2)

  • CWE-284 Improper Access Control weakness
  • CWE-77 Improper Neutralization of Special Elements used in a Command weakness

References