<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/"><channel><title>Phoenix Framework — CraftedSignal Threat Feed</title><link>https://feed.craftedsignal.io/vendors/phoenix-framework/</link><description>Trending threats, MITRE ATT&amp;CK coverage, and detection metadata — refreshed continuously.</description><generator>Hugo</generator><language>en</language><managingEditor>hello@craftedsignal.io</managingEditor><webMaster>hello@craftedsignal.io</webMaster><lastBuildDate>Wed, 03 Jan 2024 15:00:00 +0000</lastBuildDate><atom:link href="https://feed.craftedsignal.io/vendors/phoenix-framework/feed.xml" rel="self" type="application/rss+xml"/><item><title>Bandit WebSocket Memory Exhaustion Vulnerability</title><link>https://feed.craftedsignal.io/briefs/2024-01-bandit-websocket-dos/</link><pubDate>Wed, 03 Jan 2024 15:00:00 +0000</pubDate><author>hello@craftedsignal.io</author><guid isPermaLink="true">https://feed.craftedsignal.io/briefs/2024-01-bandit-websocket-dos/</guid><description>An unauthenticated attacker can exhaust server memory by sending unbounded WebSocket continuation frames in Bandit-fronted applications, leading to a denial of service.</description><content:encoded><![CDATA[<p>A vulnerability exists in Bandit, a web server for Elixir, where a single unauthenticated WebSocket client can exhaust server memory. The vulnerability stems from the fragmented-message reassembly path, which appends every <code>Continuation{fin: false}</code> frame&rsquo;s payload to a per-connection iolist without any cumulative size cap. This allows an attacker to stream continuation frames indefinitely (without setting <code>fin=1</code>), causing the BEAM heap to grow linearly until the operating system or a supervisor terminates the process. This issue affects applications using Phoenix Channels and LiveView, as they rely on <code>WebSock</code> on Bandit. The exploit is effective even with common deployment topologies, including L4 load balancers and HTTP-mode reverse proxies. The recommended fix involves tracking a running cumulative byte count on the connection state and introducing a configurable <code>max_message_size</code>.</p>
<h2 id="attack-chain">Attack Chain</h2>
<ol>
<li>Establish a WebSocket connection with a Bandit-fronted application.</li>
<li>Send a WebSocket text frame with the <code>fin</code> bit set to <code>0</code>.</li>
<li>Send a series of WebSocket continuation frames with the <code>fin</code> bit set to <code>0</code>.</li>
<li>Each continuation frame&rsquo;s payload is appended to a per-connection iolist.</li>
<li>The iolist grows linearly in BEAM memory as continuation frames are sent without limit.</li>
<li>The attacker does not send a final frame with <code>fin=1</code>, preventing the iolist from being processed and cleared.</li>
<li>The server&rsquo;s memory consumption increases until it reaches the system limit.</li>
<li>The server process is terminated due to excessive memory usage, causing a denial of service.</li>
</ol>
<h2 id="impact">Impact</h2>
<p>The vulnerability allows for unauthenticated denial-of-service attacks via memory exhaustion. A single connection can consume gigabytes of BEAM heap, and a small number of concurrent connections can cause the host to run out of memory. This affects any Phoenix application that accepts WebSocket connections, including those using Phoenix Channels and LiveView. The absence of a mitigation strategy makes applications vulnerable by default. A successful attack can lead to service disruption and downtime.</p>
<h2 id="recommendation">Recommendation</h2>
<ul>
<li>Monitor network traffic for WebSocket connections sending a large number of continuation frames without a final frame (fin=1).</li>
<li>Implement rate limiting for WebSocket connections to mitigate the impact of a single client exhausting resources.</li>
<li>Apply the suggested fix by tracking a running cumulative byte count on the connection state and adding a configurable <code>max_message_size</code> as described in the overview.</li>
<li>Monitor BEAM memory usage on systems running Bandit web servers to detect anomalous memory consumption.</li>
<li>Deploy the Sigma rule to detect websocket connections not sending the FIN bit.</li>
</ul>
]]></content:encoded><category domain="severity">medium</category><category domain="type">advisory</category><category>denial-of-service</category><category>websocket</category><category>memory-exhaustion</category></item></channel></rss>