Summary

http4s WebSocket decoder accepts negative length, causing infinite decode loop

Advisory details

WebSocket's FrameTranscoder.bodyLength reads a 64-bit extended payload length and rejects only values greater than Integer.MAX_VALUE. A negative length passes validation. This makes the decoder return an empty frame without advancing the buffer, and drives the decode loop into an uninterruptible infinite loop. This pins a CPU and grows an ArrayBuffer unbounded.

The defective transcoder is in http4s-core, but the denial of service manifests with http4s-ember-server.

Impact

A single frame can pin one worker at 100% CPU in an uninterruptible loop and grows memory unboundedly, resulting in a denial of service.

Preconditions

  • Server exposes a WebSocket endpoint via an Ember server.
  • Attacker completes the WebSocket handshake.

Workarounds

None

Resources

References