medium
Gorilla WebSocket Uses Cryptographically Weak PRNG for WebSocket Mask Key
- Severity
- medium CVSS:4.0 by GitHub
- Published
- Last changed
- Also known as
- GO-2026-6278
Description
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
Affected
| Product or package | Versions | Reported by |
|---|---|---|
| github.com/gorilla/websocket (Go) | before 1.5.3, before 1.5.1, from 1.5.3 before 1.5.4-0.20240701034025-d67f41855da4 | GitHub Advisory Database, Go Vulnerability Database |
Classification
What each source says
GitHub Advisory Database
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
Go Vulnerability Database
Gorilla WebSocket Uses Cryptographically Weak PRNG for WebSocket Mask Key in github.com/gorilla/websocket
References
Sources
| Source | Record | Licence |
|---|---|---|
| GitHub Advisory Database | GHSA-w67g-5rqw-f597 changed 2026-09-10 | CC-BY-4.0 |
| Go Vulnerability Database | GO-2026-6278 changed 2026-11-23 | CC-BY-4.0 |