Skip to content

Commit 0bff3ca

Browse files
1 parent d5fb20b commit 0bff3ca

File tree

1 file changed

+74
-0
lines changed

1 file changed

+74
-0
lines changed
Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
{
2+
"schema_version": "1.4.0",
3+
"id": "GHSA-7qx6-f23w-3w7f",
4+
"modified": "2026-04-14T22:53:34Z",
5+
"published": "2026-04-14T22:53:33Z",
6+
"aliases": [],
7+
"summary": "Unauthenticated Open Redirect, Arbitrary HTTP Response Header Injection, Missing CSRF, and Invisible-Mode Bypass in goshs `/?redirect` endpoint",
8+
"details": "### Summary\nThe `GET /?redirect` endpoint in `goshs` v2.0.0-beta.6 performs an HTTP redirect to any attacker-supplied `url=` value and writes any attacker-supplied `header=Name: Value` pair into the response, without scheme/host validation, without a header-name allow-list, without authentication in the default deployment, and without the `checkCSRF()` guard that GHSA-jrq5-hg6x-j6g3 added to the other state-changing GET routes (`?mkdir`, `?delete`). The same dispatcher also lacks an `fs.Invisible` branch, so the endpoint stays responsive in `-I` stealth mode and reliably fingerprints an \"invisible\" goshs deployment with a single request.\n\n\n### Details\n`httpserver/handler.go:222-228` — the dispatcher gates `?redirect` only with `denyForTokenAccess` (which only blocks share-token callers). It does not check `fs.Invisible` and does not call `checkCSRF`:\n\n```go\nif _, ok := req.URL.Query()[\"redirect\"]; ok {\n if denyForTokenAccess(w, req) {\n return true\n }\n fs.handleRedirect(w, req)\n return true\n}\n```\n\n`httpserver/handler.go:753-787` — `handleRedirect`:\n\n```go\nfunc (fs *FileServer) handleRedirect(w http.ResponseWriter, req *http.Request) {\n q := req.URL.Query()\n\n target := q.Get(\"url\") // (1) no scheme/host validation\n if target == \"\" { /* 400 */ }\n\n status := http.StatusFound\n if s := q.Get(\"status\"); s != \"\" { // (2) only constrained to 3xx\n code, err := strconv.Atoi(s)\n if err != nil || code < 300 || code > 399 { /* 400 */ }\n status = code\n }\n\n for _, h := range q[\"header\"] { // (3) arbitrary header set\n parts := strings.SplitN(h, \": \", 2)\n if len(parts) != 2 || strings.TrimSpace(parts[0]) == \"\" { /* 400 */ }\n w.Header().Set(strings.TrimSpace(parts[0]), parts[1])\n }\n\n http.Redirect(w, req, target, status) // (4) attacker Location\n\n body := fs.emitCollabEvent(req, status)\n logger.LogRequest(req, status, fs.Verbose, fs.Webhook, body)\n}\n```\n\n`httpserver/server.go:85-100` — `BasicAuthMiddleware` is registered only when `fs.User != \"\" || fs.Pass != \"\"`; the default `goshs` invocation has neither, so `?redirect` is open to anyone on the network._Give all details on the vulnerability. Pointing to the incriminated source code is very helpful for the maintainer._\n\n### PoC\n[poc.zip](https://github.com/user-attachments/files/26673401/poc.zip)\nPlease extract the uploaded compressed file before proceeding\n\n1. docker build -t goshs-poc .\n2. sh poc.sh\n\n<img width=\"1379\" height=\"197\" alt=\"스크린샷 2026-04-13 오후 8 04 20\" src=\"https://github.com/user-attachments/assets/a557846f-47c7-4640-9fc5-34aa099d1a57\" />\n\n\n### Impact\n- Cross-subdomain session fixation — `Set-Cookie: …; Domain=.corp.com` lands a fixed session on every sibling app on the parent domain.\n- TLS downgrade — `Strict-Transport-Security: max-age=0` invalidates prior HSTS state for the origin, enabling MITM on subsequent visits.",
9+
"severity": [
10+
{
11+
"type": "CVSS_V3",
12+
"score": "CVSS:3.1/AV:N/AC:L/PR:N/UI:N/S:U/C:N/I:N/A:N"
13+
}
14+
],
15+
"affected": [
16+
{
17+
"package": {
18+
"ecosystem": "Go",
19+
"name": "github.com/patrickhener/goshs"
20+
},
21+
"ranges": [
22+
{
23+
"type": "ECOSYSTEM",
24+
"events": [
25+
{
26+
"introduced": "0"
27+
},
28+
{
29+
"last_affected": "1.1.4"
30+
}
31+
]
32+
}
33+
]
34+
},
35+
{
36+
"package": {
37+
"ecosystem": "Go",
38+
"name": "github.com/patrickhener/goshs/v2"
39+
},
40+
"ranges": [
41+
{
42+
"type": "ECOSYSTEM",
43+
"events": [
44+
{
45+
"introduced": "0"
46+
},
47+
{
48+
"last_affected": "2.0.0-beta.6"
49+
}
50+
]
51+
}
52+
]
53+
}
54+
],
55+
"references": [
56+
{
57+
"type": "WEB",
58+
"url": "https://github.com/patrickhener/goshs/security/advisories/GHSA-7qx6-f23w-3w7f"
59+
},
60+
{
61+
"type": "PACKAGE",
62+
"url": "https://github.com/patrickhener/goshs"
63+
}
64+
],
65+
"database_specific": {
66+
"cwe_ids": [
67+
"CWE-601"
68+
],
69+
"severity": "LOW",
70+
"github_reviewed": true,
71+
"github_reviewed_at": "2026-04-14T22:53:33Z",
72+
"nvd_published_at": null
73+
}
74+
}

0 commit comments

Comments
 (0)