WebSocket Security Testing Checklist | Het Mehta
Skip to content

Comprehensive WebSocket Security Testing Checklist ๐Ÿ”Œ

By Het Mehta | Published: 2025-06-03 | Last Updated: 3/17/2026

Introduction

WebSockets enable persistent, full-duplex, bidirectional communication between clients and servers โ€” powering real-time features like live chat, financial trading platforms, multiplayer games, and collaborative tools. Unlike standard HTTP, a single WebSocket connection stays open indefinitely, meaning a single security flaw grants an attacker continuous, real-time access rather than a one-off request.

WebSocket security testing is a distinct discipline from regular web app testing. Traditional HTTP scanners and WAFs often miss WebSocket message traffic entirely, seeing only the initial HTTP upgrade handshake. This makes WebSocket endpoints a high-value, low-visibility target in bug bounty programs and pentest engagements alike.

This checklist is based on the OWASP WebSocket Security Cheat Sheet, PortSwigger Web Security Academy, PayloadsAllTheThings, and real-world pentest techniques.

๐Ÿงช Testing Environment Setup

WebSocket testing requires tools that can intercept and manipulate both the HTTP upgrade handshake and the subsequent bidirectional message stream โ€” standard HTTP proxies alone are not enough.

Phase 1: Reconnaissance & Handshake Analysis

Before sending a single payload, map the WebSocket attack surface. The HTTP upgrade handshake is the gateway โ€” it reveals the authentication mechanism, origin validation posture, subprotocols, and whether the connection is encrypted. Missing a misconfiguration here means missing the most common critical finding: CSWSH.

Phase 2: Transport Security

WebSocket transport security mirrors TLS testing for HTTPS. Unencrypted ws:// connections expose all message traffic to network-level eavesdropping and tampering. Even encrypted connections can be weakened by misconfigured TLS, outdated protocol versions, or insecure compression.

Phase 3: Authentication, Authorization & CSWSH ๐ŸŽฏ

Cross-Site WebSocket Hijacking (CSWSH) is the WebSocket equivalent of CSRF โ€” and often more damaging, since an attacker gets a live, persistent, bidirectional connection rather than a single forged request. It is one of the highest-impact WebSocket vulnerabilities and appears frequently in bug bounty programs. Real-world examples include a 2023 Gitpod account takeover via insufficient origin validation.

Phase 4: Input Validation & Injection Attacks ๐Ÿ’‰

WebSocket messages are just another input channel โ€” every injection class that applies to HTTP parameters also applies to WebSocket message fields. The key difference is that WebSocket payloads are often JSON or binary, so you need to adapt your payloads to the message format. Burp's WebSocket Repeater and Turbo Intruder extension make this systematic.

Phase 5: Denial-of-Service & Resource Exhaustion

WebSocket's persistent connection model fundamentally changes the DoS attack surface. Unlike HTTP where each request is independent, WebSocket allows an attacker to hold connections open indefinitely, flood message queues faster than the server can process them, or exhaust file descriptors across the system. These tests should always be performed on a staging environment with explicit permission.

Phase 6: Business Logic & Protocol Edge Cases

WebSocket applications often implement complex, stateful business logic over the message channel โ€” trading operations, multi-user collaboration, real-time auctions โ€” that automated scanners cannot reason about. This phase requires understanding what the application actually does and finding ways to abuse the intended flows.

Phase 7: Security Configuration & Logging

WebSocket-specific security configurations are often left at defaults. Verifying these controls is fast and frequently produces findings that are easy to remediate but easy to miss in a standard web application test.

Phase 8: Reporting ๐Ÿ“

WebSocket findings often need extra context in reports โ€” reviewers may not immediately understand why CSWSH is critical or how a missing rate limit on a persistent connection differs from the same issue on an HTTP endpoint. Always include the full handshake request in your evidence.

๐Ÿ“š Resources

Conclusion

WebSocket security testing is increasingly important as real-time features become standard across web applications. The persistent, bidirectional nature of WebSocket connections means that a single missed check โ€” especially missing origin validation โ€” can hand an attacker a live, authenticated session rather than a one-off forged request. Use this checklist on every engagement where you find WebSocket endpoints, adapt the payloads to the specific message format in use, and always verify both the handshake layer and the message layer independently.