Gửi #1078334: https://github.com/GopeedLab/ gopeed commit eee39e012f9681983ebe61e7549b5facb9453b77 Server-Side Request Forgerythông tin

tiêu đềhttps://github.com/GopeedLab/ gopeed commit eee39e012f9681983ebe61e7549b5facb9453b77 Server-Side Request Forgery
Mô tả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)
Nguồn⚠️ https://github.com/GopeedLab/gopeed/issues/1589
Người dùng
 carfeii (UID 97470)
Đệ trình06/11/2026 18:02 (cách đây 22 ngày)
Kiểm duyệt29/11/2026 03:35 (22 days later)
Trạng tháiđược chấp nhận
Mục VulDB445144 [GopeedLab Gopeed đến 2.0.0-beta.3 Web Proxy Endpoint pkg/rest/api.go DoProxy X-Target-Uri nâng cao đặc quyền]
điểm20

Are you interested in using VulDB?

Download the whitepaper to learn more about our service!