Quadratic CPU blow-up reassembling fragmented WebSocket messages in Bandit
mtrudel bandit
Affected versions
| Product | Affected | Fixed in |
|---|---|---|
| mtrudel bandit |
| No fix yet |
| mtrudel bandit |
| No fix yet |
Original description
Inefficient Algorithmic Complexity vulnerability in mtrudel bandit allows unauthenticated remote denial of service via CPU exhaustion during WebSocket fragment reassembly.
The size guard 'Elixir.Bandit.WebSocket.Connection':oversize_message?/2 called from handle_frame/3 in lib/bandit/websocket/connection.ex appends each non-final continuation frame to a left-nested iolist and then re-measures the entire accumulated buffer with IO.iodata_length/1 on every frame. Because the buffer grows by one element per frame and is fully re-traversed each time, reassembly work is quadratic (O(n^2)) in the number of continuation frames.