CVE-2020-27813

7.5 HIGH

📋 TL;DR

CVE-2020-27813 is an integer overflow vulnerability in websocket frame length handling that allows attackers to cause denial of service on HTTP servers with websocket support. This affects applications using the Gorilla WebSocket library. The vulnerability can crash servers by sending specially crafted websocket frames.

💻 Affected Systems

Products:
  • Gorilla WebSocket library
  • Applications using Gorilla WebSocket
  • Red Hat products using affected versions
Versions: Gorilla WebSocket versions before 1.4.0
Operating Systems: Linux, Windows, macOS - any OS running affected software
Default Config Vulnerable: ⚠️ Yes
Notes: Any application using the vulnerable Gorilla WebSocket library with websocket connections enabled is affected.

📦 What is this software?

⚠️ Risk & Real-World Impact

🔴

Worst Case

Complete server crash leading to sustained denial of service, potentially affecting multiple applications on the same server.

🟠

Likely Case

Service disruption through server crashes or resource exhaustion, requiring manual restart of affected services.

🟢

If Mitigated

Limited impact with proper network segmentation and monitoring, but still vulnerable to targeted attacks.

🌐 Internet-Facing: HIGH - Websocket servers exposed to the internet are directly vulnerable to unauthenticated attacks.
🏢 Internal Only: MEDIUM - Internal attackers or compromised internal systems could exploit this, but requires network access.

🎯 Exploit Status

Public PoC: ⚠️ Yes
Weaponized: LIKELY
Unauthenticated Exploit: ⚠️ Yes
Complexity: LOW

The vulnerability is straightforward to exploit by sending malformed websocket frames. Public advisories provide enough technical detail for exploitation.

🛠️ Fix & Mitigation

✅ Official Fix

Patch Version: Gorilla WebSocket 1.4.0 and later

Vendor Advisory: https://github.com/gorilla/websocket/security/advisories/GHSA-jf24-p9p9-4rjh

Restart Required: Yes

Instructions:

1. Update Gorilla WebSocket dependency to version 1.4.0 or later. 2. Update go.mod to require github.com/gorilla/websocket v1.4.0 or higher. 3. Rebuild and redeploy affected applications. 4. Restart services using the updated library.

🔧 Temporary Workarounds

WebSocket Connection Filtering

linux

Implement network filtering to block or limit websocket connections from untrusted sources.

iptables -A INPUT -p tcp --dport 80 -m string --string "Upgrade: websocket" --algo bm -j DROP
iptables -A INPUT -p tcp --dport 443 -m string --string "Upgrade: websocket" --algo bm -j DROP

Rate Limiting WebSocket Connections

all

Implement connection rate limiting to reduce impact of denial of service attempts.

# Configure in application or using reverse proxy like nginx: limit_conn_zone $binary_remote_addr zone=ws:10m;
limit_conn ws 10;

🧯 If You Can't Patch

  • Implement strict network segmentation to isolate websocket servers from untrusted networks
  • Deploy Web Application Firewall (WAF) with websocket protection rules

🔍 How to Verify

Check if Vulnerable:

Check go.mod or vendor dependencies for Gorilla WebSocket version. If version is below 1.4.0, the system is vulnerable.

Check Version:

grep gorilla/websocket go.mod | grep -o 'v[0-9.]\+'

Verify Fix Applied:

Verify Gorilla WebSocket version is 1.4.0 or higher in go.mod and that the application has been rebuilt with the updated dependency.

📡 Detection & Monitoring

Log Indicators:

  • Unexpected server crashes or restarts
  • High volume of websocket connection attempts
  • Error logs containing websocket frame parsing errors

Network Indicators:

  • Unusual websocket traffic patterns
  • Multiple websocket connections from single sources
  • Malformed websocket frames in packet captures

SIEM Query:

source="websocket.log" AND ("crash" OR "panic" OR "out of memory") OR (event_type="connection" AND protocol="websocket" AND count > 1000 per src_ip)

🔗 References

📤 Share & Export