| 제목 | https://github.com/GopeedLab/ gopeed commit eee39e012f9681983ebe61e7549b5facb9453b77 Server-Side Request Forgery |
|---|
| 설명 | Unauthenticated /api/web/proxy endpoint is a full-fidelity open proxy (SSRF)
Affected versions: confirmed on commit `eee39e012f9681983ebe61e7549b5facb9453b77` (2026-10-14).
## Summary
`/api/web/proxy` reads a caller-supplied `X-Target-Uri` header and relays the incoming request to that URI verbatim, returning the target's full response body and headers back to the caller. The endpoint has no destination allowlist and, in the project's own default/quick-start deployment (`docker-compose.yml`, authentication commented out), no authentication either, making it a full-fidelity, unauthenticated open proxy: a remote caller can make the gopeed server issue requests to any host/port reachable from it and read back the complete response, including to addresses the caller could not otherwise reach (internal services, cloud metadata endpoints, loopback-only admin panels).
## Details
`pkg/rest/api.go`, `DoProxy`:
```go
func DoProxy(w http.ResponseWriter, r *http.Request) {
target := r.Header.Get("X-Target-Uri")
if target == "" {
writeError(w, "param invalid: X-Target-Uri")
return
}
targetUrl, err := url.Parse(target)
if err != nil {
writeError(w, err.Error())
return
}
r.RequestURI = ""
r.URL = targetUrl
r.Host = targetUrl.Host
r.Header.Del("Cookie")
r.Header.Del("X-Api-Token")
r.Header.Del("X-Target-Uri")
resp, err := http.DefaultClient.Do(r)
if err != nil {
writeError(w, err.Error())
return
}
defer resp.Body.Close()
for k, vv := range resp.Header {
for _, v := range vv {
w.Header().Set(k, v)
}
}
w.WriteHeader(resp.StatusCode)
buf, err := io.ReadAll(resp.Body)
...
}
```
There is no check on `targetUrl.Hostname()` against any allowlist (public-internet-only, non-loopback, non-link-local, etc.), and the incoming request's own method, headers (other than the three explicitly stripped), and body are forwarded to whatever host the caller named. The full response (status, headers, body) is copied straight back to the caller, so this is not a blind SSRF primitive, the caller sees everything the target returns.
`pkg/rest/server.go` registers the route directly on the router:
```go
r.Path("/api/web/proxy").HandlerFunc(DoProxy)
...
enableApiToken := startCfg.ApiToken != ""
enableWebAuth := startCfg.WebEnable && startCfg.WebAuth != nil
...
if enableApiToken || enableWebAuth {
...
r.Use(func(h http.Handler) http.Handler { ... })
}
```
The auth middleware (gated on `/api/` path prefix) only gets installed at all when an operator has explicitly configured an API token or web username/password. Neither is set by default. The project's own `docker-compose.yml` makes this concrete:
```yaml
services:
gopeed:
ports:
- 9999:9999 # HTTP port (host:container)
...
image: liwei2633/gopeed
# command: -u Username -p Password # optional authentication
```
Authentication is explicitly commented out in the project's own quick-start compose file, with the HTTP port published to the host. So the typical "one-command Docker start" deployment this project documents leaves `/api/web/proxy` reachable by anyone who can reach that port, with no credential required.
## Steps To Reproduce
(available upon request)
## Impact
A remote, unauthenticated caller can use a gopeed instance started with its own documented default configuration as an open proxy: supply any `X-Target-Uri` and receive the complete response from that address. This enables scanning and reading from internal network services, cloud instance-metadata endpoints, and other addresses the caller would not otherwise be able to reach or read from directly, with the gopeed server acting as a fully-transparent relay (not merely a blind connection primitive).
CVSS 3.1: `AV:N/AC:L/PR:N/UI:N/S:U/C:H/I:L/A:N` (approximately 8.2, High)
CWE-918 (Server-Side Request Forgery)
|
|---|
| 원천 | ⚠️ https://github.com/GopeedLab/gopeed/issues/1589 |
|---|
| 사용자 | carfeii (UID 97470) |
|---|
| 제출 | 2026. 11. 06. PM 06:02 (22 날 ago) |
|---|
| 모더레이션 | 2026. 11. 29. AM 03:35 (22 days later) |
|---|
| 상태 | 수락 |
|---|
| VulDB 항목 | 445144 [GopeedLab Gopeed 까지 2.0.0-beta.3 Web Proxy Endpoint pkg/rest/api.go DoProxy X-Target-Uri 권한 상승] |
|---|
| 포인트들 | 20 |
|---|