{"id":"CVE-2026-50138","aliases":["CVE-2026-50138","GHSA-3whc-qvhv-xqjp","GO-2026-5878"],"related":[],"kind":"vulnerability","state":"published","title":"goshs: WebDAV listener ignores --read-only, --upload-only, and --no-delete mode flags","summary":"goshs is a SimpleHTTPServer written in Go. Prior to version 2.1.0, when `goshs` is launched with WebDAV enabled (`-w`), the mode-restriction flags `--read-only`, `--upload-only`, and `--no-delete` are enforced only on the primary HTTP port. The WebDAV port is wired straight to `golang.org/x/net/webdav.Handler` with no equivalent guard, so an authenticated WebDAV client can `PUT`, `DELETE`, `MKCOL`, `MOVE`, and `COPY` despite the operator's stated intent. Version 2.1.0 patches the issue.","summarySource":"cvelist","descriptions":[{"lang":"en","text":"goshs is a SimpleHTTPServer written in Go. Prior to version 2.1.0, when `goshs` is launched with WebDAV enabled (`-w`), the mode-restriction flags `--read-only`, `--upload-only`, and `--no-delete` are enforced only on the primary HTTP port. The WebDAV port is wired straight to `golang.org/x/net/webdav.Handler` with no equivalent guard, so an authenticated WebDAV client can `PUT`, `DELETE`, `MKCOL`, `MOVE`, and `COPY` despite the operator's stated intent. Version 2.1.0 patches the issue.","source":"cvelist"},{"lang":"en","text":"# WebDAV listener ignores `--read-only`, `--upload-only`, and `--no-delete` mode flags\n\n**Ecosystem:** Go\n**Package:** `goshs.de/goshs/v2` (`github.com/patrickhener/goshs`)\n**Affected:** `<= v2.0.9` (every release that ships the WebDAV handler)\n\n## Summary\n\nWhen `goshs` is launched with WebDAV enabled (`-w`), the mode-restriction flags `--read-only`, `--upload-only`, and `--no-delete` are enforced only on the primary HTTP port. The WebDAV port is wired straight to `golang.org/x/net/webdav.Handler` with no equivalent guard, so an authenticated WebDAV client can `PUT`, `DELETE`, `MKCOL`, `MOVE`, and `COPY` despite the operator's stated intent.\n\n## Details\n\n[`httpserver/server.go:207-238`](https://github.com/patrickhener/goshs/blob/v2.0.9/httpserver/server.go#L207-L238) — the WebDAV mux registers only `IPWhitelistMiddleware`, `ServerHeaderMiddleware`, and optionally `BasicAuthMiddleware`. There is no `fs.ReadOnly || fs.UploadOnly || fs.NoDelete` check on the WebDAV path. The HTTP mux in the same file (lines 134-204) does check these flags on every state-changing route.\n\n## Proof of concept\n\n```bash\nmkdir -p /tmp/r && echo secret > /tmp/r/x.txt\ngoshs -p 18000 -wp 18001 -w -ro -d /tmp/r -b admin:pw &\n\ncurl -u admin:pw -X PUT    http://localhost:18000/y.txt --data x   # 403  (HTTP enforces -ro)\ncurl -u admin:pw -X PUT    http://localhost:18001/y.txt --data x   # 201  (WebDAV writes anyway)\ncurl -u admin:pw -X DELETE http://localhost:18001/x.txt            # 204  (WebDAV deletes anyway)\ncurl -u admin:pw -X MKCOL  http://localhost:18001/pwned/           # 201  (WebDAV creates dir)\n```\n\n## Impact\n\n- **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.\n- **Confidentiality** — `--upload-only` is also bypassed: WebDAV GET/PROPFIND still return file contents.\n- **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.\n\n## Suggested fix\n\nAdd a small `http.HandlerFunc` in front of `wdHandler` that maps WebDAV verbs to the existing mode flags:\n\n```go\nwdGuard := http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) {\n    switch r.Method {\n    case http.MethodPut, \"MKCOL\", \"MOVE\", \"COPY\":\n        if fs.ReadOnly || fs.UploadOnly { http.Error(w, \"read-only\", 403); return }\n    case http.MethodDelete:\n        if fs.ReadOnly || fs.UploadOnly || fs.NoDelete { http.Error(w, \"delete disabled\", 403); return }\n    case http.MethodGet, \"PROPFIND\", \"HEAD\":\n        if fs.UploadOnly { http.Error(w, \"upload-only\", 403); return }\n    }\n    wdHandler.ServeHTTP(w, r)\n})\n```\n\nAdd regression tests in `integration/functions.go` covering each mode flag × each WebDAV verb.\n\nReporter: Nishant Verma. Reproduced live against `goshs v2.0.9` (commit `8fc1e91`) on 2026-05-27.","format":"markdown","source":"ghsa"},{"lang":"en","text":"goshs: WebDAV listener ignores --read-only, --upload-only, and --no-delete mode flags in goshs.de/goshs","format":"markdown","source":"go"},{"lang":"es","text":"goshs es un SimpleHTTPServer escrito en Go. Antes de la versión 2.1.0, cuando “goshs” se inicia con WebDAV habilitado (“-w”), los indicadores de restricción de modo “--read-only”, “--upload-only” y “--no-delete” se aplican solo en el puerto HTTP principal. El puerto WebDAV está conectado directamente a “golang.org/x/net/webdav.Handler” sin una protección equivalente, por lo que un cliente WebDAV autenticado puede “PUT”, “DELETE”, “MKCOL”, “MOVE” y “COPY” a pesar de la intención declarada del operador. La versión 2.1.0 corrige el problema.","source":"nvd"}],"published":"2026-07-01T21:56:40.000Z","modified":"2026-10-22T22:10:00.250Z","severity":{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N","score":8.1,"rating":"HIGH"},"severities":[{"scorer":"GitHub_M","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N","score":8.1,"rating":"HIGH"},{"scorer":"GitHub","scheme":"CVSS:3.1","vector":"CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:H/A:N","score":8.1,"rating":"HIGH"}],"cwes":["CWE-284"],"affected":[{"ranges":[{"version":"< 2.1.0","status":"affected"}],"vendor":"patrickhener","product":"goshs","source":"cvelist"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"2.1.0"}],"ecosystem":"Go","package":"goshs.de/goshs/v2","purl":"pkg:golang/goshs.de/goshs/v2","source":"ghsa"},{"ranges":[{"type":"semver","introduced":"0","status":"affected"}],"ecosystem":"Go","package":"goshs.de/goshs","purl":"pkg:golang/goshs.de/goshs","source":"go"},{"ranges":[{"type":"semver","introduced":"0","status":"affected","fixed":"2.1.0"}],"ecosystem":"Go","package":"goshs.de/goshs/v2","purl":"pkg:golang/goshs.de/goshs/v2","source":"go"}],"references":[{"url":"https://github.com/goshs-labs/goshs/security/advisories/GHSA-3whc-qvhv-xqjp","tags":["x-refsource-confirm"],"sources":["cvelist","nvd"]},{"url":"https://github.com/patrickhener/goshs/security/advisories/GHSA-3whc-qvhv-xqjp","tags":["advisory","web"],"sources":["ghsa","go"]},{"url":"https://github.com/patrickhener/goshs","tags":["package"],"sources":["ghsa"]}],"credits":[],"assigner":"GitHub_M","ssvc":{"scorer":"CISA-ADP","exploitation":"poc","automatable":"no","technicalImpact":"total","date":"2026-08-19T14:29:52.649Z"},"sources":[{"source":"cvelist","name":"CVE List","id":"CVE-2026-50138","url":"https://www.cve.org/CVERecord?id=CVE-2026-50138","licence":"CVE Terms of Use","modified":"2026-08-19T14:30:24.965Z"},{"source":"ghsa","name":"GitHub Advisory Database","id":"GHSA-3whc-qvhv-xqjp","url":"https://github.com/advisories/GHSA-3whc-qvhv-xqjp","licence":"CC-BY-4.0","modified":"2026-07-07T16:11:06.128Z"},{"source":"go","name":"Go Vulnerability Database","id":"GO-2026-5878","url":"https://pkg.go.dev/vuln/GO-2026-5878","licence":"CC-BY-4.0","modified":"2026-07-07T16:01:31.264Z"},{"source":"nvd","name":"NVD","id":"CVE-2026-50138","url":"https://nvd.nist.gov/vuln/detail/CVE-2026-50138","licence":"Public domain","modified":"2026-10-22T22:10:00.250Z"}],"updatedAt":"2026-11-25T22:59:33.472Z","epss":{"score":0.00416,"percentile":0.37877,"date":"2026-12-01T12:00:22.000Z"}}