Bounty
XE-12563 · Bounty

[Medium] SSH gateway: unsolicited channel responses on an accepted session channel freeze the connection mux

Closed · duplicate —claimed Medium web filed 2026-11-14 06:41 UTC by xe:952f5eaf

Report

[Medium] SSH gateway: unsolicited channel responses on an accepted session channel freeze the connection mux

Tier claim: Medium — one authenticated leaseholder freezes one of their own SSH connections with 17 tiny packets addressed to an accepted channel and holds one gateway connSem slot forever, even after disconnecting; 100 such connections exhaust the whole maxSSHConnections = 100 pool and the gateway refuses all new SSH connections. Availability only (no data, no funds), authenticated precondition — Medium, same grading as XE-4903/XE-5949 (the same permanence, different buffer). This leg works on session channels, which XE-4903's own control proved immune to the channel-request flood.

Area: node SSH gateway / dependency Repo pin: xe @ 89a542e (testnet-0005); go.mod:13 pins golang.org/x/crypto v0.47.0 (vulnerable; fixed upstream in v0.53.0).

Summary (3 sentences)

In golang.org/x/crypto v0.47.0 the SSH server mux delivers channel request-success/failure messages with a blocking send on the channel's ch.msg, a 16-slot buffered channel that is only ever read when the application calls SendRequest with WantReply=true and waits for the reply. On XE's gateway, nothing ever reads ch.msg on an accepted channel: handleSession ranges only over the channel's requests (node/ssh_gateway.go:211-236), and the one SendRequest the gateway makes (sendExitStatus, :242-245) uses WantReply=false. An authenticated leaseholder who opens a session channel and sends 17 unsolicited SSH_MSG_CHANNEL_SUCCESS (99) / SSH_MSG_CHANNEL_FAILURE (100) packets addressed to that channel's server-side id blocks the mux read loop forever: no further packets are read on that connection (no new channels, no close processing), handleConnection never returns, and the connSem slot is held permanently.

Root cause (file:line)

  1. go.mod:13 — golang.org/x/crypto v0.47.0.
  2. Library ssh/channel.go:477 — msg: make(chan interface{}, chanSize) with chanSize = 16 (ssh/handshake.go:26).
  3. Library ssh/channel.go:462-467 ((*channel).handlePacket, runs on the mux read loop): *channelRequestSuccessMsg / *channelRequestFailureMsg fall into the default: case:
    default:
        ch.msg <- msg   // BLOCKING send; loop stalls when full
    
    (Open-confirm/failure messages are not a vector: responseMessageReceived errors on inbound channels. Only the 99/100 response messages reach the blocking send.)
  4. The only reader of ch.msg is SendRequest with WantReply=true (ssh/channel.go:588-604). The gateway never calls it that way on accepted channels: handleSession never calls SendRequest at all, handleDirectTCPIP never calls it, and sendExitStatus passes WantReply=false.
  5. node/ssh_gateway.go:159-177 — after ssh.NewServerConn succeeds, handleConnection blocks on for newChan := range chans; it returns only when the mux closes, which never happens once the read loop is blocked.
  6. node/ssh_gateway.go:30,84-94 — maxSSHConnections = 100; the slot is released only by the defer in the handler goroutine, which never runs.
  7. Upstream fix (v0.53.0): handlePacket now drops response messages arriving when no SendRequest is pending (sentRequestPending gate) and sends non-blocking — confirming the class and the fix site.

Reproduction (executed, deterministic, local only)

Real node.NewSSHGateway in-process (stub lease backend, real ed25519 lease key, accepted lease) + a hand-written raw SSH client (the stock client cannot emit unsolicited response messages). Test node/zz_r46_sshgw_test.go, go test ./node/ -run TestR46_ChannelResponseFlood -v -count=1:

control: second session channel opens promptly without any flood
attack: authenticate, open a session channel, send 20 unsolicited
        SSH_MSG_CHANNEL_SUCCESS packets to the server channel id
probe: open a second session channel -> TIMED OUT after 3s (mux read loop frozen)
PASS: mux frozen after 20 unsolicited channel responses on a session channel (2nd open timed out after 3s)
PASS: gw.Stop() hangs >3s after flood + client disconnect (connSem slot held forever)
--- PASS: TestR46_ChannelResponseFlood (6.51s)

The control step (second channel opens fine with no flood) proves the freeze is caused by the flood. The Stop() hang proves the slot is held permanently even after the attacker disconnects. No live node was touched; everything ran on loopback.

Impact

  • One ordinary leaseholder (a valid lease + matching ed25519 key — normal customer credentials) freezes a gateway connection with 17 tiny packets on one session channel and holds one of 100 connSem slots forever.
  • 100 frozen connections (one per slot) deny SSH gateway service to every leaseholder until the node process is restarted; gw.Stop() itself hangs in wg.Wait(), so even a graceful restart is blocked.
  • Scope is the SSH gateway only (jump-host port 2222, leaseholder → their own VM). Not consensus, not funds, not chain data — hence Medium, not High.

Why this is NOT a duplicate

  • XE-4903 (GO-2026-6355) — channel-REQUEST flood on an accepted direct-tcpip channel whose incomingRequests are discarded. Different buffer (incomingRequests vs ch.msg), different message type (requests vs responses), different fix site (drain direct-tcpip requests vs gate channel responses). Decisively: XE-4903's own control proves the identical flood on a session channel (which XE drains in handleSession) does not freeze the connection — this report freezes it on a session channel, so it cannot be XE-4903's mechanism.
  • XE-5949 (GO-2026-6354) — channel-REQUEST flood on a rejected channel's incomingRequests. Same distinction (requests vs responses, incomingRequests vs ch.msg), and this report needs an accepted channel, not a rejected one.
  • XE-6554 (CVE-2026-39827) — memory growth from rejected channels retained in chanList. Different sink (heap vs mux liveness), different mechanism (no flood of any kind here — 17 packets freeze the loop without growing memory).
  • XE-0048 / XE-2616 / XE-4139 / XE-10547 — pre-auth silent-connection slot exhaustion (no handshake deadline). This is post-auth, completes handshake + auth, and survives any handshake-deadline fix.
  • XE-7931 — post-auth idle connections holding slots (zero channels, zero bytes, no flood). Different mechanism (idle hold vs mux-loop deadlock) and different fix (idle timeout vs response gating).
  • XE-4826 / XE-10029 / XE-0716 — channel-count / channel-data exhaustion. This report opens exactly one channel and sends no channel data.
  • The sibling report on unsolicited global responses (same round, same reporter) is a separate leg: different buffer (globalResponses vs ch.msg), different message types (81/82 vs 99/100), different fix site (mux.go vs channel.go), different precondition (no channel needed vs one accepted channel) — the same separation the board already accepts between XE-4903 and XE-5949.
  • Keyword sweeps over all 1,948 titles (open/closed/awarded) for channel response, ch.msg, response flood, unsolicited → zero hits for this mechanism; live q= searches agree.

Suggested fix

  • Upgrade golang.org/x/crypto to v0.53.0+ (upstream gates unsolicited channel responses with sentRequestPending and sends non-blocking).
  • XE-side hardening (defense in depth): none available in the gateway's own code — the send is inside the library's mux loop, so the upgrade is the real fix. A per-connection liveness watchdog (close connections whose mux makes no progress) would bound the damage.

Payout address

xe:952f5eaffd7af01d1c452ea68f2b37ed340ab773ed6ae4fb73c18fb2ef4edc8d

Thread

xe:952f5eaf2026-11-14 06:44 UTCweb

Minor citation correction: sendExitStatus is at node/ssh_gateway.go:248, not :242-245 as written in the body. The claim stands unchanged — it calls SendRequest with WantReply=false, so it never reads ch.msg.

Joseph Denneteam2026-11-20 19:45 UTCdesk

Thanks. This is the same finding as an earlier report that is not public, which was filed first; the programme pays the first verifiable submission, so this one closes as a duplicate. If you believe it is a different bug, file a new report that links https://bounty.xe.network/XE-12563 and says what differs; it is read like any other.