GitHub Advisoryadvisory · Go
GHSA-3whc-qvhv-xqjp goshs: WebDAV listener ignores --read-only, --upload-only, and --no-delete mode flags
HIGH
Official page ↗
- Aliases
- CVE-2026-50138
- Ecosystem
- Go
- Packages
- goshs.de/goshs/v2
- Severity
- High
- CVSS vector
- CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N
- Weaknesses
- CWE-284
- Reviewed
- 2026-07-01
Affected packages
• Go goshs.de/goshs/v2: < 2.1.0 → fixed in 2.1.0
Description
WebDAV listener ignores `--read-only`, `--upload-only`, and `--no-delete` mode flags
Ecosystem: Go
Package: `goshs.de/goshs/v2` (`github.com/patrickhener/goshs`)
Affected: ` /tmp/r/x.txt
goshs -p 18000 -wp 18001 -w -ro -d /tmp/r -b admin:pw &
curl -u admin:pw -X PUT http://localhost:18000/y.txt --data x # 403 (HTTP enforces -ro)
curl -u admin:pw -X PUT http://localhost:18001/y.txt --data x # 201 (WebDAV writes anyway)
curl -u admin:pw -X DELETE http://localhost:18001/x.txt # 204 (WebDAV deletes anyway)
curl -u admin:pw -X MKCOL http://localhost:18001/pwned/ # 201 (WebDAV creates dir)
```
Impact
• Integrity — `--read-only` and `--no-delete` are silently downgraded to "no protection" on the WebDAV port. Any WebDAV client (curl, cadaver, Windows Explorer, Finder) can overwrite/delete files.
• Confidentiality — `--upload-only` is also bypassed: WebDAV GET/PROPFIND still return file contents.
• Trust — operators using `goshs -w -ro -d /srv/case-files -b reviewer:pw` to deliver engagement artifacts believe the directory is immutable. It isn't.
Suggested fix
Add a small `http.HandlerFunc` in front of `wdHandler` that maps WebDAV verbs to the existing mode flags:
```go
wdGuard := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {
switch r.Method {
case http.MethodPut, "MKCOL", "MOVE", "COPY":
if fs.ReadOnly || fs.UploadOnly { http.Error(w, "read-only", 403); return }
case http.MethodDelete:
if fs.ReadOnly || fs.UploadOnly || fs.NoDelete { http.Error(w, "delete disabled", 403); return }
case http.MethodGet, "PROPFIND", "HEAD":
if fs.UploadOnly { http.Error(w, "upload-only", 403); return }
}
wdHandler.ServeHTTP(w, r)
})
```
Add regression tests in `integration/functions.go` covering each mode flag × each WebDAV verb.
Reporter: Nishant Verma. Reproduced live against `goshs v2.0.9` (commit `8fc1e91`) on 2026-05-27.
Related
Alias · CVE (1)
- CVE-2026-50138 goshs is a SimpleHTTPServer written in Go. vulnerability
Weakness · CWE (1)
- CWE-284 Improper Access Control weakness