# GHSA-w67g-5rqw-f597: Gorilla WebSocket Uses Cryptographically Weak PRNG for WebSocket Mask Key

- Severity: Medium (CVSS:4.0, scored by GitHub) `CVSS:4.0/AV:N/AC:L/AT:N/PR:N/UI:N/VC:L/VI:L/VA:N/SC:N/SI:N/SA:N`
- Known to be exploited: not in CISA's catalogue, which lists only what CISA has confirmed
- Published: 2026-08-24T21:00:54.000Z
- Modified: 2026-11-23T20:30:10.450Z
- Also known as: GO-2026-6278
- Weaknesses: CWE-338

## 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

(As written by GitHub Advisory Database.)

## Affected

- github.com/gorilla/websocket (Go): before 1.5.3; before 1.5.1; from 1.5.3 before 1.5.4-0.20240701034025-d67f41855da4

## References

- <https://github.com/canolgun-commits/websocket/security/advisories/GHSA-w67g-5rqw-f597> (advisory, web)
- <https://github.com/gorilla/websocket/commit/d67f41855da42d7bccd9ef050c49f7e54e783b95> (fix, web)
- <https://github.com/canolgun-commits/websocket> (package)
- <https://github.com/gorilla/websocket/releases/tag/v1.5.3> (web)

## Sources

- GitHub Advisory Database: [GHSA-w67g-5rqw-f597](https://github.com/advisories/GHSA-w67g-5rqw-f597), CC-BY-4.0, modified 2026-09-10
- Go Vulnerability Database: [GO-2026-6278](https://pkg.go.dev/vuln/GO-2026-6278), CC-BY-4.0, modified 2026-11-23

---

Page: https://cve.day/GHSA-w67g-5rqw-f597 · Whole record: https://cve.day/GHSA-w67g-5rqw-f597.json · Rebuilt by cve.day 2026-11-25T22:56:25.300Z
