This educational article covers WebSocket security vulnerabilities in bug bounty testing, specifically Cross-Site WebSocket Hijacking (CSWSH) and message injection attacks. It demonstrates why WebSocket endpoints represent high-severity, under-tested attack surface in real-time applications and provides hands-on methodology for discovering, exploiting, and reporting these vulnerabilities using browser tools and Burp Suite.
- WebSocket authentication bypasses standard CSRF protectionWebSocket connections establish authentication once during the initial HTTP Upgrade handshake using the browser's cookies, then treat all subsequent messages as authenticated without per-message verification. This differs from regular HTTP requests where CSRF tokens protect each POST. The Upgrade request itself can originate from any origin (including attacker-controlled pages) if the server does not validate the Origin header, allowing hijacking of the authenticated connection.
- CSWSH requires three specific conditions to exploitThe vulnerability needs: (1) authentication via cookies only with no custom authorization header, (2) no CSRF token in the Upgrade request URL or parameters, and (3) missing Origin header validation by the server. Testing involves modifying the Origin header to an attacker domain in Burp Repeater and observing whether the server responds with 101 Switching Protocols (vulnerable) versus 403 Forbidden (protected). Breaking any single condition prevents the attack.
- WebSocket endpoints remain hidden from standard scanningWebSocket connections are created dynamically by JavaScript and do not appear in HTML links, sitemaps, or standard URL enumeration, causing automated scanners to miss them entirely. The article provides four discovery methods: Browser DevTools Network tab filtered by WS, Burp Suite WebSockets history tab, JavaScript source code searching for 'new WebSocket' or 'ws://' patterns, and brute-forcing common paths like /ws, /socket, /stream, /realtime.
- CSWSH proof-of-concept uses minimal HTML and data exfiltrationThe PoC is a simple HTML page served from an attacker domain containing JavaScript that opens a WebSocket connection to the target using wss://target.com/ws. The victim's browser automatically includes their session cookie in the Upgrade request. Messages received from the hijacked connection are exfiltrated to an attacker-controlled endpoint using fetch() and Burp Collaborator, creating out-of-band evidence of successful data theft.
- Burp Suite WebSockets history tab mirrors HTTP testing workflowWebSocket traffic appears in Proxy → WebSockets history rather than standard HTTP history. The workflow involves viewing the Upgrade request to check for Origin/CSRF tokens, sending it to Repeater to modify the Origin header, intercepting live messages via Proxy → Options → WebSocket Interception Rules, and replaying individual messages from history by right-clicking and selecting Send to Repeater to test for injection vulnerabilities.
- Message injection attacks exploit missing server-side validationWebSocket messages containing JSON properties like userId, role, or command strings are processed without sufficient server validation. Testing patterns include modifying userId values to detect IDOR, changing role fields from 'user' to 'admin' for privilege escalation, and injecting XSS payloads into message content fields. Modified messages are replayed in Burp Repeater to observe whether the server reflects, executes, or acts on the injected content.
- CSWSH severity depends on data exposed, not victim interactionAccount data, transaction history, or messages enabling account actions score High to Critical (7.5–9.0 CVSS). Read-only non-sensitive data scores Low to Informational (3.0–5.0). Victim interaction via phishing or malicious links does not reduce severity — it is a standard prerequisite for the attack, not a limiting factor. Financial and health platform data typically scores 8.0+ CVSS.
- Effective CSWSH reports require specific technical evidenceReports must include the WebSocket endpoint URL, original Upgrade request from Burp, modified Upgrade with attacker Origin, server's 101 acceptance response, PoC HTML code, and screenshots showing data received and decoded victim information. This three-screenshot package (modified Upgrade, Collaborator callback with received data, decoded victim information) makes the finding undeniable during triage and demonstrates complete exploit chain.
Bottom line: WebSocket endpoints in real-time applications represent consistently high-severity, under-tested attack surface that bypasses standard CSRF controls; hunters using DevTools, Burp Suite WebSockets history, and the three-condition CSWSH testing methodology can identify and exploit these vulnerabilities faster than competitors who focus only on REST APIs. The methodology is straightforward enough to implement in two to three hours per target yet delivers findings that often receive top-tier payouts
FREE
Part of the Bug Bounty Mastery Course
That is the WebSocket bug bounty opportunity in 2026. Every real-time application — trading platforms, customer support tools, multiplayer games, collaboration software, live dashboards — runs WebSockets. The connection mechanism bypasses the CSRF controls that protect regular HTTP requests. Burp Suite intercepts and replays WebSocket messages as easily as HTTP. The findings are high severity. The competition is almost zero. Day 23 closes that gap.
🎯 What You’ll Master in Day 23
⏱️ Day 23 · 3 exercises · Browser + PortSwigger + Burp Suite
✅ Prerequisites
- Day 22 — GraphQL Bug Bounty
— WebSocket and GraphQL both run on non-standard protocol layers; the API-first mindset from Day 22 carries directly into today
- Day 5 — Burp Suite Deep Dive
— Burp Suite Proxy and Repeater are the primary tools for today; comfortable interception is required
- Burp Suite installed and configured as browser proxy — all exercises require active Burp interception
📋 WebSocket Bug Bounty Day 23 — Contents
Yesterday in Day 22 you learned how GraphQL’s introspection endpoint exposes the entire API schema to anyone who queries it. WebSockets have an equivalent blind spot: the authentication that protects regular HTTP requests does not automatically extend to WebSocket connections. Together these two attack surfaces represent the non-standard protocol layer that the majority of bug bounty hunters skip entirely — and where consistent high-severity findings live.
How WebSockets Work — The Security Difference From HTTP
A WebSocket connection starts as a regular HTTP request — specifically an Upgrade request that asks the server to switch from HTTP to the WebSocket protocol. The server responds with a 101 Switching Protocols. From that point, the connection is persistent and bidirectional: the client and server exchange messages freely over the same TCP connection without the overhead of repeated HTTP requests.
Here is what matters for security: that initial HTTP Upgrade request carries the browser’s cookies. If the user is logged in, their session cookie rides along with the Upgrade. The server sees an authenticated connection and accepts it. From that point, every message sent over the WebSocket is treated as coming from that authenticated user — without any further per-message authentication check.
Compare this to a regular AJAX request. If a developer adds CSRF protection, every POST carries a token that proves the request originated from the correct page. WebSocket connections establish authentication once at upgrade time — and the upgrade request is triggered by JavaScript on any page, including pages on other origins. If the server does not validate the Origin header, an attacker’s page can open a WebSocket connection using the victim’s browser, inheriting their authentication, and reading or sending messages as that user.
Finding WebSocket Endpoints in Bug Bounty Targets
WebSocket endpoints do not appear in HTML links, sitemap files, or standard URL enumeration. They are created dynamically by JavaScript. That is why most automated scanners miss them entirely — and why hunters who look for them manually find fresh, untested attack surface.
Four methods I use on every target to surface WebSocket connections. Run all four — different methods catch different implementations.
⏱️ 15 minutes · Browser only · No install required
Before testing any WebSocket vulnerability, you need to know every WebSocket endpoint the application uses. This exercise builds the discovery habit that runs before every WebSocket assessment — the same workflow I use at the start of every real-time application recon phase.
with a free account. These are real-world WebSocket-heavy apps
safe to observe (not to attack — observe only here).
Step 2: Open DevTools (F12) and click the Network tab.
Filter by WS (WebSocket). Reload the page.
Note how many WebSocket connections appear immediately.
Step 3: Click each WebSocket connection to inspect it.
In the Messages sub-tab, observe the real-time message flow:
— What format are the messages? JSON? Binary? Text?
— Can you identify authentication data in the initial messages?
— What information is being streamed?
Step 4: Now switch to a bug bounty target.
Find a target in your active programme that has real-time features:
— Live notifications
— Chat or messaging
— Real-time data dashboards
— Collaborative editing
Apply the same DevTools discovery process.
List every WebSocket endpoint you find.
Step 5: For each endpoint, note:
— The ws:// or wss:// URL
— The Upgrade request HTTP method and path
— Whether you can see a CSRF token in the handshake
— What data flows in the messages
📸 Screenshot your DevTools Network WS tab showing discovered endpoints and save it in your notes.
Cross-Site WebSocket Hijacking — Detection and Exploitation
CSWSH is the WebSocket equivalent of CSRF. The attack works because WebSocket connections use cookies for authentication but the browser’s same-origin policy does not prevent cross-origin WebSocket connections the way it prevents cross-origin AJAX requests. The attacker’s page can open a WebSocket to any origin — and the victim’s browser will include their cookies.
Three conditions need to line up for CSWSH to work. Break any one of them and the attack stops.
When all three conditions are met, I build the proof-of-concept. The PoC is a minimal HTML page that a victim visits (via social engineering, phishing, or a malicious ad). The page opens a WebSocket connection to the target application. The victim’s browser sends their authentication cookie. The server treats it as an authenticated connection. The PoC receives whatever data the server streams.
⏱️ 20 minutes · Free PortSwigger account required
PortSwigger has a dedicated CSWSH lab that provides the exact environment to prove this vulnerability with a working exploit — using Burp Collaborator as your data collection endpoint (Collaborator is a Burp Pro feature. On Community Edition, use the lab’s exploit server or a free Interactsh URL wherever this lesson says Collaborator.). Work through the full chain: discover, test Origin validation, build PoC, capture victim data.
Read the lab description and click “Access the lab.”
The lab simulates a live chat application with a vulnerable WebSocket.
Step 2: In Burp Suite, enable Intercept and visit the lab.
Go to Proxy → WebSockets history.
Find the initial Upgrade request for the chat WebSocket.
Step 3: Send the Upgrade request to Burp Repeater.
Change the Origin header to: https://YOUR-COLLABORATOR.oastify.com
Send it. Does the server return 101?
Step 4: If 101 — Origin validation is absent.
Now build the CSWSH PoC.
Go to Burp → Collaborator → Copy to clipboard (your Collaborator URL).
Step 5: Create the exploit HTML using the exploit server:
Click “Store” then “Deliver exploit to victim.”
Step 6: Check Burp Collaborator for incoming requests.
The victim’s chat history should arrive base64-encoded.
Decode it — you should see the victim’s private messages
and their username/email.
Step 7: Document the full chain for your report:
— Modified Upgrade request (screenshot)
— Exploit HTML
— Collaborator showing received data (screenshot)
— Decoded data showing victim information
📸 Screenshot your Collaborator showing the decoded victim chat history and save it in your notes.
Message Injection and Authentication Bypass
Beyond CSWSH, WebSocket messages themselves are often processed without sufficient server-side validation. The same assumptions that create SQL injection — “this input comes from our own application so it must be safe” — appear in WebSocket message handlers. If the server processes WebSocket message content as commands, queries, or structured data without validation, you can manipulate that data to affect other users or access unauthorised functionality.
I look for three injection patterns in WebSocket messages. First: JSON properties that map to backend queries. A message like {"action":"getOrders","userId":"123"} is an obvious IDOR candidate — change the userId value and check whether the server enforces authorisation. Second: messages that contain role or permission fields. Any message where the client sends {"role":"user"} and the server trusts it without independent verification is a privilege escalation waiting to happen. Third: messages that include raw command strings processed server-side — these are the rarest but highest-impact variant.
Burp Suite WebSocket Testing Workflow
Burp Suite handles WebSockets natively. The workflow is almost identical to HTTP testing once you know where to look. The key difference: WebSocket messages do not appear in the standard HTTP history — they have their own dedicated tab.
⏱️ 20 minutes · Burp Suite · PortSwigger Academy lab
This exercise puts message manipulation in your hands using Burp Repeater. You will intercept live WebSocket traffic, modify message content, and observe the server’s response — the exact workflow for testing IDOR, privilege escalation, and injection in WebSocket applications.
Go to: portswigger.net/web-security/websockets
Find: “Manipulating WebSocket messages to exploit vulnerabilities”
Access the lab — it is a live chat application.
Step 2: In Burp Suite, enable intercept for WebSocket messages
Proxy → Options → WebSocket Interception Rules
Enable: Intercept client-to-server messages
Step 3: Send a chat message in the lab application
When Burp intercepts it, inspect the raw message format:
{“message”:”Hello World”}
Step 4: Modify the message content to inject a payload
Change “Hello World” to an XSS payload:
{“message”:”<img src=1 onerror='alert(1)'>”}
Forward the modified message.
Step 5: Observe the response
Does the injected payload execute in the chat window?
If yes: the server is reflecting message content without sanitisation.
This is stored XSS delivered via WebSocket message injection.
Step 6: Now test the Repeater workflow
WS History → right-click the intercepted message → Send to Repeater
In Repeater: modify the message again with a different payload
Click Send and read the server’s response in the right panel.
Step 7: Document the finding
Capture: original message, modified message, response showing execution.
Calculate CVSS: Stored XSS via WebSocket = what is the scope?
Does it affect other users? What data can be stolen?
📸 Screenshot Burp showing the modified message and the XSS execution in the lab. Keep it in your notes.
Reporting WebSocket Vulnerabilities
WebSocket findings get triaged faster when the report includes the specific technical detail reviewers need. The vulnerability class is unfamiliar to many developers — your job is to make the impact immediately clear without assuming they know what CSWSH means.
For CSWSH reports, always include: the WebSocket endpoint URL, the original Upgrade request from Burp, the modified Upgrade with attacker Origin, the server’s 101 response confirming acceptance, the PoC HTML, and a screenshot of the data received (even from a test account — this is what proves impact). For CVSS, the base score depends on what data the connection exposes. Account data or the ability to perform account actions scores 7.5–9.0. Read-only non-sensitive data scores 3.0–5.0.
📋 WebSocket Bug Bounty — Day 23 Reference Card
✅ Day 23 Complete — WebSocket Security
CSWSH, Origin validation bypass, message injection, and the complete Burp Suite WebSocket workflow. Day 24 covers CRLF injection — header injection, response splitting, and the XSS chain that makes it a high-severity finding despite looking like a minor formatting issue.
🧠 Day 23 Check
❓ WebSocket Bug Bounty FAQ
What is Cross-Site WebSocket Hijacking?
How do WebSockets differ from regular HTTP for security testing?
What does Burp Suite show for WebSocket traffic?
What is WebSocket message injection?
How do you find WebSocket endpoints in a bug bounty target?
What severity is a CSWSH vulnerability typically rated?
Day 22 — GraphQL Bug Bounty
Day 24 — CRLF Injection Bug Bounty
📚 Further Reading
- Day 22 — GraphQL Bug Bounty — The other non-standard protocol attack surface. GraphQL introspection + WebSocket CSWSH are the two most consistently under-tested areas in modern web apps.
- Day 5 — Burp Suite Deep Dive — The complete Burp Suite workflow guide — Proxy, Repeater, Intruder, and Collaborator are all used in WebSocket testing.
- Bug Bounty Mastery Course Hub — Full course overview — Day 23 WebSocket sits in the advanced protocol attacks phase alongside HTTP Request Smuggling and GraphQL.
- PortSwigger — WebSockets Security — The definitive hands-on reference with four progressive labs covering CSWSH, message manipulation, and multi-step exploitation chains.
- OWASP — Cross-Site WebSocket Hijacking — The formal vulnerability definition with CSWSH attack prerequisites, detection methods, and prevention controls for developers.

