Vulnerabilities in pkg:golang/github.com/gorilla/websocket

PACKAGE
Advisory Summary

GHSA-w67g-5rqw-f597 is a MODERATE gorilla websocket uses cryptographically weak vulnerability (CWE-338: Use of Cryptographically Weak Pseudo-Random Number Generator (PRNG)) affecting Github.com/gorilla/websocket libraries in the Go ecosystem. The issue involves gorilla websocket uses cryptographically weak prng for websocket mask key. Remediation is available by upgrading affected packages to version 1.5.3.

2 Known Advisory Record(s)
Package Vulnerability Intelligence

pkg:golang/github.com/gorilla/websocket

2 Known Advisory Record(s)

Vulnerability advisories affecting package pkg:golang/github.com/gorilla/websocket. Select an advisory below to view technical details or fixes.

Advisory ID CVE / NVD Severity Summary
GHSA-w67g-5rqw-f597 - MODERATE Gorilla WebSocket Uses Cryptographically Weak PRNG for WebSocket Mask Key
GHSA-3xh2-74w9-5vxm CVE-2020-27813 HIGH Integer overflow in github.com/gorilla/websocket

GHSA-w67g-5rqw-f597 at a Glance

CVE Identifier N/A
GHSA Identifier GHSA-w67g-5rqw-f597
Severity MODERATE
CVSS v3.1 Base Score N/A
CWE Classification CWE-338: Use of Cryptographically Weak Pseudo-Random Number Generator (PRNG)
Affected Product Github.com/gorilla/websocket
Package Ecosystem Go
Published Date
Last Updated

How to Fix GHSA-w67g-5rqw-f597

To remediate this vulnerability, upgrade all affected Github.com/gorilla/websocket dependencies to a patched release. Both direct and transitive dependencies should be checked, as frameworks or security libraries may pull in vulnerable versions transitively.

github.com/gorilla/websocket fixed: 1.5.3
Upgrade github.com/gorilla/websocket to 1.5.3
Verify Direct and Transitive Dependencies

Run the following command in your project directory to verify that all resolved dependencies use the patched release:

inspect dependencies for github.com/gorilla/websocket

How to Check if You Are Affected

To determine whether your application is affected by GHSA-w67g-5rqw-f597, inspect your project dependencies for Github.com/gorilla/websocket:

inspect dependencies for github.com/gorilla/websocket

Analyze the terminal output to locate any version of Github.com/gorilla/websocket in your dependency tree. If any resolved version matches the vulnerable ranges listed in the table below (for example, versions earlier than 1.5.3), your application is affected.

Note: Verify declared build manifests and deployed runtime container environments.

Technical Details

Vulnerability Mechanism & Technical Analysis

This vulnerability is classified under CWE-338: Use of Cryptographically Weak Pseudo-Random Number Generator (PRNG), where the product uses a pseudo-random number generator (prng) in a security context, but the prng's algorithm is not cryptographically strong. In Github.com/gorilla/websocket, software state validation or input boundaries are circumvented during processing. Review the official source advisory statement below for specific affected components, classes, and reproduction details.

Source Advisory Statement

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

GHSA-w67g-5rqw-f597 Affected Github.com/gorilla/websocket Versions

1 component(s)
Fixed Versions:
1.5.3
Product / Package Ecosystem Affected Versions Fixed Version
github.com/gorilla/websocket
Go
< 1.5.3
1.5.3

References

Frequently Asked Questions

What is GHSA-w67g-5rqw-f597?
GHSA-w67g-5rqw-f597 is a security vulnerability in Github.com/gorilla/websocket involving Gorilla WebSocket Uses Cryptographically Weak PRNG for WebSocket Mask Key under CWE-338: Use of Cryptographically Weak Pseudo-Random Number Generator (PRNG).
Which Github.com/gorilla/websocket versions are affected?
Affected versions include releases prior to 1.5.3 across affected packages: github.com/gorilla/websocket.
What version fixes GHSA-w67g-5rqw-f597?
Upgrading to 1.5.3 (or the latest patched release for your respective branch) resolves the vulnerability.
Is github.com/gorilla/websocket affected?
Yes, github.com/gorilla/websocket is affected in releases prior to 1.5.3. Upgrade your dependency to 1.5.3 or later.
What CWE is associated with GHSA-w67g-5rqw-f597?
GHSA-w67g-5rqw-f597 is classified under CWE-338: Use of Cryptographically Weak Pseudo-Random Number Generator (PRNG) (The product uses a Pseudo-Random Number Generator (PRNG) in a security context, but the PRNG's algorithm is not cryptographically strong.).
How can I check Go dependencies for GHSA-w67g-5rqw-f597?
Run the dependency tree command: 'inspect dependencies for github.com/gorilla/websocket'. This command lists direct and transitive dependencies in your build configuration so you can verify if a vulnerable version is resolved.
Machine-readable OSV JSON OSV v1.5 Schema
Normalized schema output
{
  "schema_version" : "1.4.0",
  "id" : "GHSA-w67g-5rqw-f597",
  "modified" : "2026-08-24T21:00:54Z",
  "published" : "2026-08-24T21:00:54Z",
  "aliases" : [ ],
  "summary" : "Gorilla WebSocket Uses Cryptographically Weak PRNG for WebSocket Mask Key",
  "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.\n\n**Type:** Use of Cryptographically Weak Pseudo-Random Number Generator\n**Fix:** Replaced math/rand with crypto/rand (commit d67f4185, released in v1.5.3)\n**Credit:** bounty-hunter v6.0 silent-fix detection",
  "severity" : [ {
    "type" : "CVSS_V4",
    "score" : "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"
  } ],
  "affected" : [ {
    "package" : {
      "ecosystem" : "Go",
      "name" : "github.com/gorilla/websocket"
    },
    "ranges" : [ {
      "type" : "ECOSYSTEM",
      "events" : [ {
        "introduced" : "0"
      }, {
        "fixed" : "1.5.3"
      } ]
    } ]
  } ],
  "references" : [ {
    "type" : "WEB",
    "url" : "https://github.com/canolgun-commits/websocket/security/advisories/GHSA-w67g-5rqw-f597"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/gorilla/websocket/commit/d67f41855da42d7bccd9ef050c49f7e54e783b95"
  }, {
    "type" : "PACKAGE",
    "url" : "https://github.com/canolgun-commits/websocket"
  }, {
    "type" : "WEB",
    "url" : "https://github.com/gorilla/websocket/releases/tag/v1.5.3"
  } ],
  "database_specific" : {
    "cwe_ids" : [ "CWE-338" ],
    "severity" : "MODERATE",
    "github_reviewed" : true,
    "github_reviewed_at" : "2026-08-24T21:00:54Z",
    "nvd_published_at" : null
  }
}