Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

Go proxy allows websocket attach (GET /containers/{name}/attach/ws), giving stdin access to containers

Đã đóng
#76 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
48/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
docker, go, rust, typescript
Lĩnh vực
api, backend, security

Hướng nghiên cứu

Start with the Go router and go/internal/proxy/transport.go, then compare the Rust and TypeScript transports. Read spec/router.qnt and the existing execNeverAllowed rule; add coverage in the three router tables and an integration check for the websocket upgrade. Done means attach paths are denied across methods and the upgrade receives the proxy's 403 in all three implementations.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

Priority: P0 Type: Bug

Describe the bug
The Go proxy lets a client write to a container's stdin through a websocket attach: GET /containers/{name}/attach/ws?stdin=1&stream=1 with Upgrade: websocket. The router treats it as a read (GET passthrough), and go/internal/proxy/transport.go (httputil.ReverseProxy) passes the protocol upgrade through, so the client gets a bidirectional stream to the container. Attaching to a container whose main process is a shell is equivalent to exec, which the proxy exists to deny. This holds with and without --readonly.

Found in the review of the #75 fix (fix/readonly-router-75); not introduced by it.

Affected implementation(s)

  • Go: exploitable (reproduced)
  • Rust: forwards the upgrade request and relays the daemon's 101, but the connection breaks right after; no stdin reached the container
  • TypeScript: the request timed out; no stdin reached the container

Rust and TS are not exploitable in this probe, but both forward an attach request they should deny.

To Reproduce

  1. docker run -d -i --name zzws busybox sh -c 'while read l; do echo "GOT:$l" >> /tmp/in.txt; done'
  2. Run the Go proxy (--readonly or not) with --config-dir=deploy/config.
  3. Over the proxy socket, send GET /containers/zzws/attach/ws?stdin=1&stream=1 HTTP/1.1 with Upgrade: websocket, Connection: Upgrade, Sec-WebSocket-Key, Sec-WebSocket-Version: 13, then one masked text frame pwned-via-readonly-proxy.
  4. Result: HTTP/1.1 101 Switching Protocols; docker exec zzws cat /tmp/in.txt prints GOT:pwned-via-readonly-proxy. Audit log: "decision":"ALLOW" … "path":"/containers/zzws/attach/ws".

Expected behavior

  • Deny attach in the router for every method, like exec: attach as a whole segment after /containers/{name} (covering /attach and /attach/ws), with a message such as attach is not allowed. (POST /containers/{name}/attach is already default-denied as a non-lifecycle POST; the GET …/attach/ws form is the gap.)
  • Refuse protocol upgrades in all three transports: strip or reject requests carrying Upgrade/Connection: Upgrade, so no endpoint can be turned into a raw stream. Defence in depth; the Docker CLI's legitimate uses of upgrade (attach, exec start) are already denied.
  • Spec: an attach deny rule and property in spec/router.qnt mirroring execNeverAllowed; table rows in all three; an integration check that the upgrade is refused with the proxy's 403.

Alternatives considered:

  • Only block upgrades in the transport. Rejected alone: the plain (non-upgrade) POST /containers/{id}/attach hijack path should stay denied by the router too, and the router is where the spec lives.
  • Treat --readonly specially. Rejected: the gap exists in every mode.

Environment

  • Docker 29.4.0 (OrbStack); Go binary from fix/readonly-router-75 (same router/transport as main for this path).

Additional context
Consider a security advisory for the Go releases once fixed.

Ngôn ngữ chính
Rust
Star
2
Fork
0
Merge trung bình
14 giờ 26 phút
Pull request đã merge (30 ngày)
27

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của ChainSafe/docker-socket-policy

Tất cả issue của ChainSafe/docker-socket-policy

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.