<!-- XE-12562 · [Medium] SSH gateway: unsolicited global SSH responses freeze the connection mux, permanently holding a connSem slot · testnet -->
*Markdown view of <https://bounty.xe.network/XE-12562>. The page is the record; this is the same page for reading.*

XE-12562 · Bounty

# \[Medium\] SSH gateway: unsolicited global SSH responses freeze the connection mux, permanently holding a connSem slot

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

Verdict
:   Duplicate

Tier
:   —

Claimed
:   Medium

Area
:   Node / API

Duplicate of
:   —

Tracked
:   internally

Updated
:   2026-11-20 19:46 UTC

Told
:   2026-11-20 19:46 UTC

### Patches

None linked.

### History

- [626551](https://bounty.xe.network/log/626551) 2026-11-20 19:46 UTC proposal.adopted
- [626550](https://bounty.xe.network/log/626550) 2026-11-20 19:46 UTC reply.sent
- [626549](https://bounty.xe.network/log/626549) 2026-11-20 19:46 UTC ticket.status new → closed
- [623098](https://bounty.xe.network/log/623098) 2026-11-20 19:45 UTC proposal.adopted
- [623097](https://bounty.xe.network/log/623097) 2026-11-20 19:45 UTC proposal.adopted
- [623096](https://bounty.xe.network/log/623096) 2026-11-20 19:45 UTC ticket.facts
- [623095](https://bounty.xe.network/log/623095) 2026-11-20 19:45 UTC proposal.adopted
- [623094](https://bounty.xe.network/log/623094) 2026-11-20 19:45 UTC ticket.facts
- [623093](https://bounty.xe.network/log/623093) 2026-11-20 19:45 UTC proposal.adopted
- [623092](https://bounty.xe.network/log/623092) 2026-11-20 19:45 UTC ticket.facts
- [609690](https://bounty.xe.network/log/609690) 2026-11-20 15:04 UTC note.added
- [609689](https://bounty.xe.network/log/609689) 2026-11-20 15:04 UTC proposal.created

[Full history](https://bounty.xe.network/log?ref=XE-12562) · [JSON](https://bounty.xe.network/v1/tickets/XE-12562) · [markdown](https://bounty.xe.network/XE-12562.md)

### Report

# \[Medium\] SSH gateway: unsolicited global SSH responses freeze the connection mux, permanently holding a connSem slot

**Tier claim: Medium** — one authenticated leaseholder freezes one of their own SSH connections with 17 tiny packets 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).

**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 unsolicited global request-success/failure messages with a **blocking send** on `m.globalResponses`, a 16-slot buffered channel that is only ever read when the application itself sends a global request and waits for the reply. XE's SSH gateway never sends a global request (`node/ssh_gateway.go` only ever *discards* inbound global requests via `ssh.DiscardRequests`), so `globalResponses` is never drained. An authenticated leaseholder who sends 17 unsolicited `SSH_MSG_REQUEST_SUCCESS` (81) / `SSH_MSG_REQUEST_FAILURE` (82) packets 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 — no channel needs to be opened at all.

## Root cause (file:line)

1. `go.mod:13` — `golang.org/x/crypto v0.47.0`.
2. Library `ssh/mux.go:121` — `globalResponses: make(chan interface{}, chanSize)` with `chanSize = 16` (`ssh/handshake.go:26`).
3. Library `ssh/mux.go:270` (`handleGlobalPacket`, runs on the mux read loop):

   ```
   case *globalRequestSuccessMsg, *globalRequestFailureMsg:
       m.globalResponses <- msg   // BLOCKING send; loop stalls when full
   ```

   The only reader of `globalResponses` is `(*mux).sendGlobalRequest` (`ssh/mux.go:143`), which the gateway never calls.
4. `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.
5. `node/ssh_gateway.go:30,84-94` — `maxSSHConnections = 100`; the slot is released only by the `defer` in the handler goroutine, which never runs.
6. Upstream fix (v0.53.0): `handleGlobalPacket` now drops responses arriving when no `SendRequest` is pending (`globalSentPending` 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_GlobalResponseFlood -v -count=1`:

```
control: second session channel opens promptly without any flood
attack: authenticate, send 20 unsolicited SSH_MSG_REQUEST_SUCCESS packets (no channel opened)
probe: open a second session channel -> TIMED OUT after 3s (mux read loop frozen)
PASS: mux frozen after 20 unsolicited global responses (2nd channel open timed out after 3s)
PASS: gw.Stop() hangs >3s after flood + client disconnect (connSem slot held forever)
--- PASS: TestR46_GlobalResponseFlood (6.51s)
```

The control step (second channel opens fine with no flood) proves the freeze is caused by the flood, not by a broken gateway. The `Stop()` hang proves the slot is held permanently even after the attacker disconnects — the same permanence XE-4903 demonstrated for its leg. 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 zero-payload packets 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 `globalResponses`), different message type (requests vs responses), different fix site (drain direct-tcpip requests / established-state vs gate global responses). XE-4903's own control proves session channels are immune to its flood; this report needs **no channel at all**.
- **XE-5949 (GO-2026-6354)** — channel-REQUEST flood on a *rejected* channel's `incomingRequests`. Same distinction: requests vs responses, `incomingRequests` vs `globalResponses`, and this report works with zero channels open (5949 needs a rejected channel).
- **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). A fix for XE-7931 does not unblock a frozen mux loop.
- **XE-4826 / XE-10029 / XE-0716** — channel-count / channel-data exhaustion. This report opens zero channels.
- Keyword sweeps over all 1,948 titles (open/closed/awarded) for `unsolicited`, `globalResponses`, `global response`, `request success`, `response flood` → zero hits for this mechanism; live `q=` searches agree.

## Suggested fix

- Upgrade `golang.org/x/crypto` to v0.53.0\+ (upstream gates unsolicited global responses with `globalSentPending` 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:952f5eaf**2026-11-14 06:44 UTCweb

Correction to the report body (does not change the mechanism or severity — it makes the finding stronger): `globalResponses` is NOT a 16-slot buffer. `ssh/mux.go:120` constructs it as `make(chan interface{}, 1)` — buffer 1, not `chanSize`. The mux read loop therefore blocks on the 2nd unsolicited global response, not the 17th. Confirmed with a 2-packet PoC (`TestR46_GlobalResponseTwoPackets`): after 2 unsolicited SSH\_MSG\_REQUEST\_SUCCESS packets, a second channel open timed out after 3s and gw.Stop() hung \>3s after client disconnect — identical permanence to the 20-packet repro in the body. Correct figures: 2 packets freeze the connection (not 17); buffer is 1 (not 16); citation is mux.go:120 (not mux.go:121).

**Joseph Denne**team2026-11-20 19:46 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-12562 and says what differs; it is read like any other.
