Описание
Beszel: Docker API has a Path Traversal Vulnerability via Unsanitized Container ID
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:
Agent (agent/docker.go:651-652 and 682-683): raw containerID interpolated into Docker API URL:
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).
All three requests returned real data from the Docker Engine API on the agent host.
Impact
Any authenticated user (including readonly role) can read arbitrary Docker Engine API GET endpoints on all connected agent hosts. Exposed information includes: hostname, OS version, kernel version, Docker version, container inventory, image list, network topology, storage driver configuration, and security options. This is a privilege escalation, readonly users should not have access to host-level infrastructure details.
Researcher
Sergio Cabrera https://www.linkedin.com/in/sergio-cabrera-878766239/
Пакеты
github.com/henrygd/beszel
<= 0.18.3
0.18.4
Связанные уязвимости
Beszel is a server monitoring platform. Prior to version 0.18.2, 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. Version 0.18.4 fixes the issue.
Beszel is a server monitoring platform. Prior to version 0.18.2, the h ...