# GHSA-7qx6-f23w-3w7f: The `GET /?redirect` endpoint in `goshs` v2.0.0-beta.6 performs an HTTP redirect to any attacker-supplied `url=` value and write

> Attackers can exploit unauthenticated open redirect and header injection in goshs to bypass security controls and fingerprint stealth deployments.

- **Severity:** Not scored
- **Exploited in the wild:** Not known
- **Login needed:** Not needed
- **Attackable:** Over the internet
- **Victim action needed:** A user has to click or open something
- **Fix available:** No
- **Published:** 14 Apr 2026
- **Also known as:** GO-2026-5232

## What is GHSA-7qx6-f23w-3w7f?

GHSA-7qx6-f23w-3w7f is a vulnerability in github.com/patrickhener/goshs, published on 14 Apr 2026. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.

### Official description

### Summary
The `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.

### Details
`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`:

```go
if _, ok := req.URL.Query()["redirect"]; ok {
    if denyForTokenAccess(w, req) {
        return true
    }
    fs.handleRedirect(w, req)
    return true
}
```

`httpserver/handler.go:753-787` — `handleRedirect`:

```go
func (fs *FileServer) handleRedirect(w http.ResponseWriter, req *http.Request) {
    q := req.URL.Query()

    target := q.Get("url")                                   // (1) no scheme/host validation
    if target == "" { /* 400 */ }

    status := http.StatusFound
    if s := q.Get("status"); s != "" {                        // (2) only constrained to 3xx
        code, err := strconv.Atoi(s)
        if err != nil || code < 300 || code > 399 { /* 400 */ }
        status = code
    }

    for _, h := range q["header"] {                          // (3) arbitrary header set
        parts := strings.SplitN(h, ": ", 2)
        if len(parts) != 2 || strings.TrimSpace(parts[0]) == "" { /* 400 */ }
        w.Header().Set(strings.TrimSpace(parts[0]), parts[1])
    }

    http.Redirect(w, req, target, status)                    // (4) attacker Location

    body := fs.emitCollabEvent(req, status)
    logger.LogRequest(req, status, fs.Verbose, fs.Webhook, body)
}
```

`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._

### PoC
[poc.zip](https://github.com/user-attachments/files/26673401/poc.zip)
Please extract the uploaded compressed file before proceeding

1. docker build -t goshs-poc .
2. sh poc.sh

<img width="1379" height="197" alt="스크린샷 2026-04-13 오후 8 04 20" src="https://github.com/user-attachments/assets/a557846f-47c7-4640-9fc5-34aa099d1a57" />

### Impact
- Cross-subdomain session fixation — `Set-Cookie: …; Domain=.corp.com` lands a fixed session on every sibling app on the parent domain.
- TLS downgrade — `Strict-Transport-Security: max-age=0` invalidates prior HSTS state for the origin, enabling MITM on subsequent visits.

## Which versions are affected by GHSA-7qx6-f23w-3w7f?

6 open source packages ship an affected version, including github.com/patrickhener/goshs and github.com/patrickhener/goshs/v2.


| Package | Ecosystem | Affected | Fixed in |
| --- | --- | --- | --- |
| `github.com/patrickhener/goshs` | Go | All versions | None |
| `github.com/patrickhener/goshs` | Go | All versions to 1.1.4 | None |
| `github.com/patrickhener/goshs` | Go | All versions to 1.1.4 | None |
| `github.com/patrickhener/goshs/v2` | Go | All versions | None |
| `github.com/patrickhener/goshs/v2` | Go | All versions to 2.0.0-beta.6 | None |
| `github.com/patrickhener/goshs/v2` | Go | All versions to 2.0.0-beta.6 | None |

## How do I fix GHSA-7qx6-f23w-3w7f?

No fix has been published for GHSA-7qx6-f23w-3w7f yet. Limit exposure of the affected software until one is available.

## Is GHSA-7qx6-f23w-3w7f being exploited?

There is no known exploitation of GHSA-7qx6-f23w-3w7f in the wild and no public exploit code.

## Fix prompt for AI coding agents

```text
Check this codebase for GHSA-7qx6-f23w-3w7f and fix it if it is affected.

What it is: GHSA-7qx6-f23w-3w7f is a vulnerability in github.com/patrickhener/goshs, published on 14 Apr 2026. An attacker can exploit it over the internet without logging in, and only if a user opens a file or follows a link.
Exploitation: There is no known exploitation of GHSA-7qx6-f23w-3w7f in the wild and no public exploit code.

Affected packages and fixed versions:
- github.com/patrickhener/goshs (Go): affected all versions; no fix listed
- github.com/patrickhener/goshs (Go): affected all versions up to 1.1.4; no fix listed
- github.com/patrickhener/goshs (Go): affected all versions up to 1.1.4; no fix listed
- github.com/patrickhener/goshs/v2 (Go): affected all versions; no fix listed
- github.com/patrickhener/goshs/v2 (Go): affected all versions up to 2.0.0-beta.6; no fix listed
- github.com/patrickhener/goshs/v2 (Go): affected all versions up to 2.0.0-beta.6; no fix listed

Task:
1. Search the dependency manifests and lockfiles (for example package.json, package-lock.json, requirements.txt, poetry.lock, uv.lock, pom.xml, build.gradle, go.mod, Cargo.lock, Gemfile.lock) and any Dockerfiles for the affected packages, including transitive dependencies.
2. If an affected version is in use, upgrade it to the fixed version for its release line with the project's package manager, so the lockfile is regenerated. Prefer the smallest upgrade that fixes it.
3. If there is no fix, or the upgrade would break the build, do not guess: explain the risk and the safest workaround instead.
4. Run the tests and summarise what changed and why.
5. If nothing in the project is affected, say so and change nothing.

Reference: https://insights.sbomify.com/GHSA-7qx6-f23w-3w7f/ (Markdown: https://insights.sbomify.com/GHSA-7qx6-f23w-3w7f/index.md)
```

## Sources

- OSV: https://osv.dev/vulnerability/GHSA-7qx6-f23w-3w7f

---
From sbomify Insights: https://insights.sbomify.com/GHSA-7qx6-f23w-3w7f/
Summaries are generated and may contain mistakes; the official description above is the record.
