GHSA-w67g-5rqw-f597: Weak RNG
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 Software
Remediation
Recommended actions to resolve this vulnerability, in priority order.
- Upgrade
Upgrade
go/github.com/gorilla/websocketto a version that resolves this vulnerability.Fixed in 1.5.3 - Upgrade
Upgrade
gorilla/websocketto a version that resolves this vulnerability.Fixed in v1.5.3Patch d67f4185
Event History
Frequently Asked Questions
Which versions are affected and what version fixes the issue?
Versions prior to the commit d67f4185 are affected. The fix, which replaces math/rand with crypto/rand for WebSocket frame mask keys, was released in v1.5.3.
What conditions are required for exploitation?
An attacker must be able to predict or recover the deterministic math/rand output used for WebSocket frame mask keys. Predictable mask keys can enable injection of content into WebSocket connections.
What should teams do if they cannot immediately upgrade?
The provided data identifies upgrading to v1.5.3 or later as the available remediation. No temporary configuration workaround or mitigation is specified.