# GO-2026-6940: Unbounded allocation from peer-declared frame length in github.com/gobwas/ws

- Database: Go
- Published: 2026-11-23
- Modified: 2026-11-23

## Affected versions

- github.com/gobwas/ws (Go): fixed in 1.5.0

## Description

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.

## References

- https://github.com/gobwas/ws/security/advisories/GHSA-4xr6-hc3h-f6jq
- https://github.com/gobwas/ws/commit/6b485812604c20a7174f3d68a64379121bcddfe2
- https://github.com/gobwas/ws/pull/229
- https://github.com/gobwas/ws/issues/223

Page: https://cve.now/GO-2026-6940

Wrong or missing data? Send feedback: POST https://cve.now/api/v1/feedback (see https://cve.now/agents#feedback).
