MediumGHSA-w67g-5rqw-f597GO-2026-6278

Gorilla WebSocket Uses Cryptographically Weak PRNG for WebSocket Mask Key

Published 24 Aug 2026 · Updated 10 Sept 2026

Is your project on an affected github.com/gorilla/websocket?

Private repo? Upload its lockfile instead, or connect GitHub to check every repo.

Look after several Go apps? Indie watches up to 15 repos, private ones too, for $5 a month. See Indie

Affected package

Affected
<1.5.3
Fixed in
1.5.3
Update to the fixed version for your release line, for example:go get github.com/gorilla/websocket@v1.5.3

Details

gorilla/websocket used math/rand (cryptographically weak pseudo-random number generator) to generate WebSocket frame mask keys prior to commit d67f4185. WebSocket masking keys MUST be unpredictable to prevent frame content injection attacks. math/rand produces deterministic output when seeded with a known value, enabling an attacker to predict or recover mask keys and inject content into WebSocket connections.

Type: Use of Cryptographically Weak Pseudo-Random Number Generator Fix: Replaced math/rand with crypto/rand (commit d67f4185, released in v1.5.3) Credit: bounty-hunter v6.0 silent-fix detection

Is GHSA-w67g-5rqw-f597 in any of your client repos?

Checking one package by hand is fine. Checking it across forty client projects is not. NPMscan reads the lockfiles in every GitHub repo you pick, finds each project with an affected github.com/gorilla/websocket, and gives you the command that fixes it.

More advisories for github.com/gorilla/websocket

  • HighCVE-2020-27813Integer overflow in github.com/gorilla/websocket · 18 May 2021
  • LowCVE-2020-27813Integer overflow in github.com/gorilla/websocket · 14 Apr 2021
github.com/gorilla/websocket security overview

References

Advisory data from OSV.dev (opens OSV.dev in a new tab), refreshed daily.