Skip to content

fix(security): replace direct Docker socket mount with restricted proxy - #2489

Closed
failsafesecurity wants to merge 1 commit into
fastapi:masterfrom
failsafesecurity:openclaw/fix-traefik-docker-socket-exposure
Closed

failsafesecurity wants to merge 1 commit into
fastapi:masterfrom
failsafesecurity:openclaw/fix-traefik-docker-socket-exposure

Conversation

@failsafesecurity

Copy link
Copy Markdown

Security fix: Traefik mounts Docker socket read-only (still grants root)

Severity: HIGH
CWE: CWE-250 (Execution with Unnecessary Privileges)
File: compose.yml

What this fixes

Traefik mounted /var/run/docker.sock directly with :ro. Read-only on the Docker socket does not prevent write operations through the Docker API — any process with read access to the socket can still call POST /containers/create, POST /images/load, POST /networks/connect, etc. A compromise of the Traefik container gives full root-level control over the host's Docker daemon (all containers, images, volumes, networks, secrets).

The change

Replace the direct Docker socket mount with a tecnativa/docker-socket-proxy sidecar that:

  • Mounts the real /var/run/docker.sock (read-only)
  • Only exposes read-only endpoints: CONTAINERS=1, SERVICES=1, TASKS=1
  • Blocks all write operations: POST=0
  • Traefik connects via --providers.docker.endpoint=tcp://docker-socket-proxy:2375

This is the standard remediation for Docker socket exposure in compose-based deployments. Traefik only needs to list containers and read labels — it never needs to create, start, stop, or remove containers.

Impact if unpatched

If an attacker achieves code execution inside the Traefik container (e.g., via a crafted request, plugin vulnerability, or misconfigured rule), they can:

  • Start privileged containers with host mounts
  • Exfiltrate secrets from other containers
  • Pivot to any service on the Docker network
  • Effectively gain root on the host

Prepared by OpenClaw BountyBot. Finding surfaced by Failsafe Nexus (Pandora) and the patch adversarially reviewed by GLM. Please review carefully — automated patches are a starting point, not a guarantee.

Traefik mounted /var/run/docker.sock directly (even :ro), which grants
root-level access to the Docker daemon. Any compromise of the Traefik
container gives full control over the host's containers, images, volumes,
and networks.

Replace the direct mount with a tecnativa/docker-socket-proxy that only
exposes read-only container/service/task endpoints (POST=0). Traefik
points to the proxy via --providers.docker.endpoint.

Signed-off-by: Yajat Kapur Failsafe <yajat@getfailsafe.com>
@github-actions

Copy link
Copy Markdown
Contributor

This was marked as potentially AI generated and will be closed now. If this is an error, please provide additional details, make sure to read the docs about contributing and AI.

@github-actions github-actions Bot closed this Sep 25, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants