GO-2026-6940: Unbounded allocation from peer-declared frame length in github.com/gobwas/ws
ws.ReadFrame, ws.MustReadFrame, and the wsutil message readers allocate a buffer of the payload length declared in the frame header before reading any payload bytes. A remote unauthenticated peer can send a frame header declaring a large payload length and cause an out-of-memory crash.
Affected Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
go/github.com/gobwas/wsto a version that resolves this vulnerability.Fixed in 1.5.0
Event History
Frequently Asked Questions
Who can trigger the memory exhaustion condition?
A remote unauthenticated peer can trigger it by sending a frame header that declares a very large payload length. No payload bytes need to be sent before the affected readers allocate memory.
Which code paths are affected?
The affected paths are ws.ReadFrame, ws.MustReadFrame, and the wsutil message readers. These allocate a buffer based on the payload length declared in the frame header before reading the payload.
How can I tell whether an instance has been attacked?
The described impact is an out-of-memory crash following receipt of a frame with an excessively large declared payload length. Review crash and memory-exhaustion events alongside WebSocket peer traffic if available.