Beszel: Docker API has a Path Traversal Vulnerability via Unsanitized Container ID
Date: 2026-02
Affected: go/github.com/henrygd/beszel
Attack vector: deserialization
Category: vulnerability-disclosure
Severity: Medium
CVE: CVE-2026-27734
CWE: CWE-22
CVSS: 6.5 (CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N)

### Summary The hub's authenticated API endpoints GET /api/beszel/containers/logs and GET /api/beszel/containers/info pass the user-supplied "container" query parameter to the agent without validation. The agent constructs Docker Engine API URLs using fmt.Sprintf with the raw value instead of url.PathEscape(). Since Go's http.Client does not sanitize ../ sequences from URL paths sent over unix sockets, an authenticated user (including readonly role) can traverse to arbitrary Docker API endpoints on agent hosts, exposing sensitive infrastructure details. ### Details **Hub** (internal/hub/hub.go:407-426): `containerID` from query param is only checked for emptiness, no format validation: ```go containerID := e.Request.URL.Query().Get("container") if systemID == "" || containerID == "" { ... } data, err := fetchFunc(system, containerID) // passed directly to agent ``` **Agent** (agent/docker.go:651-652 and 682-683): raw containerID interpolated into Docker API URL: ```go endpoint := fmt.Sprintf("http://localhost/containers/%s/json", containerID) endpoint := fmt.Sprintf("http://localhost/containers/%s/logs?stdout=1&stderr=1&tail=%d", containerID, dockerLogsTail) ``` Go's http.Client preserves `../` in paths over unix sockets (verified with test code). The Docker daemon resolves them via cleanPath, routing the request to unintended API endpoints. ### PoC Tested on Beszel v0.18.3 with hub and agent running in Docker (host network mode). ```bash # Authenticate TOKEN=$(curl -


Mitigations:

Architectural layers (MAESTRO):