|
| 1 | +id: GO-2025-3408 |
| 2 | +modules: |
| 3 | + - module: github.com/hashicorp/yamux |
| 4 | + versions: |
| 5 | + - introduced: 0.1.0 |
| 6 | + vulnerable_at: 0.1.2 |
| 7 | + packages: |
| 8 | + - package: github.com/hashicorp/yamux |
| 9 | + symbols: |
| 10 | + - DefaultConfig |
| 11 | + - Server |
| 12 | + - Client |
| 13 | +summary: |- |
| 14 | + DefaultConfig has dangerous defaults causing hung Read in |
| 15 | + github.com/hashicorp/yamux |
| 16 | +description: |- |
| 17 | + The default values for Session.config.KeepAliveInterval and |
| 18 | + Session.config.ConnectionWriteTimeout of 30s and 10s create the possibility for |
| 19 | + timed out writes that most aren't handling in their readers. |
| 20 | +
|
| 21 | + Calls to Stream.Read on one side of a connection will hang until the underlying |
| 22 | + Session is closed if the corresponding Stream.Write call on the other side it's |
| 23 | + waiting for returns with ErrConnectionWriteTimeout. This happens in the case of |
| 24 | + network congestion between the two sides. |
| 25 | +
|
| 26 | + If you keep Session.sendCh full (fixed capacity of 64) for |
| 27 | + ConnectionWriteTimeout, but for less than the KeepAliveInterval + |
| 28 | + ConnectionWriteTimeout (which would kill the Session), Stream.Write will return |
| 29 | + ErrConnectionWriteTimeout. The state of the underlying Session or Stream is not |
| 30 | + modified. When this happens, the other side's Stream.Read call that's waiting |
| 31 | + for that write will never return because there's no timeout for this edge-case. |
| 32 | +
|
| 33 | + Since no keep alive timed out, you can continue to use the Session once the |
| 34 | + network congestion is resolved, but that Stream.Read call will only return when |
| 35 | + the Session closes or the response shows up. Since the write call on the other |
| 36 | + side timed out the call to Stream.Read will never return. |
| 37 | +
|
| 38 | + Any conditions that cause network writes to stall for 10-30 seconds can trigger |
| 39 | + this Denial of Service- extremely high CPU contention on either side of the |
| 40 | + connection, BGP reconvergence, etc. To resolve the Denial of Service issue, you |
| 41 | + have to re-establish the connections, which will usually require a hard restart |
| 42 | + of the service on either end of the connection. |
| 43 | +credits: |
| 44 | + - Logan Attwood |
| 45 | +references: |
| 46 | + - fix: https://github.com/hashicorp/yamux/pull/143 |
| 47 | + - report: https://github.com/hashicorp/yamux/issues/142 |
| 48 | +source: |
| 49 | + id: go-security-team |
| 50 | + created: 2025-01-28T17:11:24.888252-05:00 |
| 51 | +review_status: REVIEWED |
0 commit comments