Impact What kind of vulnerability is it
Description
Impact
What kind of vulnerability is it? Who is impacted?
Denial of service through resource exhaustion (CWE-772 missing release of resource after effective lifetime, CWE-400)..
When the server initiates a WebSocket close (idle timeout, unsupported frame, or an unexpected error) it writes a Close frame and then, if the @ServerWebSocket bean has no @OnClose method, never closes the underlying connection. A client that ignores the Close frame keeps the connection, its session and its event-loop registration alive indefinitely, and each subsequent idle timeout writes another Close frame. micronaut.server.idle-timeout is therefore ineffective for such endpoints, and an attacker can accumulate connections until file descriptors or memory run out. In the other direction, a client-initiated close on an endpoint that does declare @OnClose is not echoed, which browsers report as an abnormal closure; this is a correctness issue rather than a security one.
Impacted: applications exposing a @ServerWebSocket without an @OnClose method.
Patches
Has the problem been patched? What versions should users upgrade to?
Patched in 3.10.16, 4.10.33 and 5.2.17. The server always closes the connection after its Close frame is written, or after a short forced-close timeout if the peer does not read it, and echoes a peer's Close frame before closing.
Workarounds
Is there a way for users to fix or remediate the vulnerability without upgrading?
- Declare an
@OnClosemethod on every@ServerWebSocketendpoint; with one present the connection is closed after the handler runs. - Enforce idle timeouts for WebSocket connections at a reverse proxy.
References
Are there any links users can visit to find out more?
- github.com/
micronaut-projects/ micronaut-core/ security/ advisories/ GHSA-xxxx - docs.micronaut.io/
latest/ guide/ #websocketServer - RFC 6455 section 7.1.1 (closing the connection)
Affected versions
- io.micronaut:micronaut-http-nettyfixed in 3.10.16
- io.micronaut:micronaut-http-nettyFrom 4.0.0 · fixed in 4.10.33
- io.micronaut:micronaut-http-nettyFrom 5.0.0 · fixed in 5.2.17
- io.micronaut:micronaut-http-server-nettyfixed in 3.10.16
- io.micronaut:micronaut-http-server-nettyFrom 4.0.0 · fixed in 4.10.33
- io.micronaut:micronaut-http-server-nettyFrom 5.0.0 · fixed in 5.2.17