Skip to content

In-depth lesson · technique

Cross-site WebSocket hijacking

What every disclosed Cross-site WebSocket hijacking report in the index teaches, put together: how it works, how it changed year by year, where it turns up, and things to try. Every point shows the reports it is seen in.

reports cited in this lesson
34

Overview

What it is and why programs pay for it.

Cross-site WebSocket hijacking is a form of cross-site request forgery that targets WebSocket endpoints. It happens when a WebSocket server accepts connections from any origin and authenticates users only by their cookies. An attacker can then host a page that opens a WebSocket to the vulnerable server; the victim's browser sends the session cookie automatically, and the attacker's page can read and send messages as the victim. Bug bounty programs care because this flaw can expose sensitive data or allow actions on behalf of the user, often with minimal interaction.

The impact usually ranges from reading private information such as chat history, documents or session identifiers to performing state-changing actions like editing documents, changing settings or even taking over accounts. It is most often found in real-time features: chat applications, collaborative editors, login flows, notification streams and local services that expose WebSocket servers. Any endpoint that relies on cookies for authentication and does not check the Origin header is a candidate.

How it works

The mechanics, as the reports show them.

The attack begins when a victim visits a malicious page while logged into the target application. The page contains JavaScript that opens a WebSocket connection to the vulnerable endpoint. Because the browser includes cookies for the target domain with the handshake request, the server sees a valid session and accepts the connection.

The key enabler is the absence of Origin header validation. Browsers send an Origin header during the WebSocket handshake, but if the server does not check it, connections from any website are accepted. Many servers also rely solely on cookies for authentication and do not require a per-message CSRF token or other client context, so the attacker's page can send and receive messages freely.

Once connected, the attacker's page can read any data the server sends, such as chat messages, document contents or session tokens, and can send messages that trigger actions. The server treats these messages as coming from the authenticated user. This is possible because the WebSocket protocol does not enforce same-origin policy by itself; it is up to the server to validate the Origin and authenticate each connection properly.

Sometimes additional weaknesses make exploitation easier. For example, cookies set with SameSite=None are sent on cross-site requests, and permissive Origin checks using substring or regex matching can be bypassed with crafted origins. Local WebSocket servers that require no authentication and accept connections from any origin are also vulnerable, especially when they run on fixed ports.

Year by year

4 years

What each year's disclosed reports show, newest first. A year with few reports says less.

Reports per yearPeak 2026: 4
Reports per year
20151
20173
20181
20202
20211
20222
20231
20253
20264
  1. 2026

    4 reports

    New this year2

    • Hosting the malicious page on a subdomain of the same registrable domain so SameSite Strict or Lax cookies are still sent is a new pattern in the disclosed reports.
    • Chaining self-XSS, cookie tossing and anti-CSRF token prediction to reach an auto-approval flow first appears in the disclosed reports.

    Turned up less1

    • The 2025 focus on local desktop WebSocket ports and client library handshake handling does not recur in the 2026 reports, which return to browser cookie and SameSite issues.
  2. 2025

    3 reports

    New this year2

    • SameSite bypasses are noted as part of the renewed cross-site WebSocket hijacking interest in the disclosed reports.
    • Attacking a desktop terminal application's local WebSocket server on a fixed port first appears in the disclosed reports.

    Kept working2

    • Hunters recreated the browser's WebSocket connection with a generic client using the same URL pattern, headers, cookies and document identifier to test whether authentication was only cookie-based.
    • Sending the client's initial READY or session-start message showed whether the server returned the full history or editor configuration.
  3. 2022

    2 reports · median $1,050

    New this year1

    • Chaining a crafted collaboration field update to a victim's build action is a new pattern in the disclosed reports.

    Turned up less1

    • The plain Origin-header swap against a login or chat socket, common in 2017, is not the focus of the 2022 reports, which instead target CSP and collaboration flows.

Earlier years1

Every point, year by year

Where it is found

20

The features and places the reports found it in, most-reported first.

  1. WebSocket endpoints used for login, documents, chat, collaboration and realtime editing.

    Seen in 5 reports
  2. Node.js socket.io and libcurl WebSocket handshake handling.

    Seen in 1 report
  3. A desktop terminal application running a local WebSocket server on a fixed port.

    Seen in 1 report
  4. A chat WebSocket that returns the full message history on a READY message.

    Seen in 1 report
  5. A self-hosted team chat product whose WebSockets do not check the Origin header.

    Seen in 1 report
View all 20

Root causes

18

The mistakes in the code or configuration behind the reports.

  1. The WebSocket server did not validate the Origin header during the handshake, so connections from any website were accepted and carried the victim's session.

    Seen in 15 reports
  2. The handshake authenticated only on cookies and required no per-message CSRF token or other client context.

    Seen in 2 reports
  3. The collaboration socket trusted client-supplied element selectors and values, and a build feature put a user-controlled value into the request URL without validation.

    Seen in 1 report
  4. The local WebSocket server required no authentication and accepted connections from any origin.

    Seen in 1 report
  5. Login, logout and OAuth connect endpoints lacked CSRF protection and profile fields allowed stored script.

    Seen in 1 report
View all 18

Things to try

The most-reported tests in the largest contexts. Tick what you have tried; ticks stay in this browser and carry over to the full checklist. Test only what a program's scope allows.

ticked in this lesson

Session cookies and SameSite behaviour

of 3 ticked
More in Session cookies and SameSite behaviour

WebSocket handshake and Origin validation

of 3 ticked
More in WebSocket handshake and Origin validation

Other

of 3 ticked
More in Other

Cloud shell and remote management endpoints

of 3 ticked
More in Cloud shell and remote management endpoints
View more things to try

Bypasses and variations

10

How reports got past filters, encoders and other defences.

  1. Host the malicious page on a subdomain of the same registrable domain so that SameSite Strict or Lax cookies are still sent.

    Seen in 3 reports
  2. Serve the malicious page from a same-site origin on a different port.

    Seen in 1 report
  3. Log the victim into the attacker's account first so the attacker's own stored XSS can read the victim's pages through same-origin frames.

    Seen in 1 report
  4. Use a crafted origin containing special characters to slip past a regex-based Origin check.

    Seen in 1 report
  5. Use an origin that the server parses as an allowed host but the browser treats as a different site.

    Seen in 1 report
View all 10

Payouts

5 paid

Public bounties in US dollars, from the data. 5 of 36 reports show an amount.

a quarter paid up to
$800
median
$1,050
three quarters paid up to
$2,000
highest
$30k

One in ten paid reports was paid $19k or more.

SeverityReportsPaidMedianHighest
Critical 1 1 $2,000 $2,000
High 3 1 $800 $800
Medium 3 0 None paid None
Low 1 1 $1,050 $1,050
Informational 1 0 None paid None
Unrated 27 2 $15k $30k

Typical fixes

7

How programs fixed it, as the reports describe.

  1. Validate the Origin header on every WebSocket handshake and reject connections from unexpected origins.

    Seen in 8 reports
  2. Do not set authentication cookies with SameSite None; use a stricter attribute so cross-site connections do not carry the session.

    Seen in 1 report
  3. Do not issue WebSocket tokens or streams before user authentication, and do not hard-code tokens in client-side source.

    Seen in 1 report
  4. Authenticate and authorise connections to local debug adapter ports and do not accept HTTP framing as debug messages.

    Seen in 1 report
  5. Validate the Origin header on state-changing notebook requests and take the CSRF token only from a header or body field, not a request parameter.

    Seen in 1 report
View all 7

Tips for beginners

13

Advice for a first hunt, drawn from the reports.

  1. Test whether the server validates the Origin header. Capture the handshake request and resend it with the Origin changed to an external site. If the server still returns a successful upgrade (101 status), it is likely vulnerable.

    Seen in 4 reports
  2. Start by identifying WebSocket endpoints in the application. Look for features like live chat, notifications, collaborative editing, login flows and real-time updates. Use browser developer tools to capture the WebSocket handshake request and note the URL, headers and cookies.

    Seen in 3 reports
  3. Check if authentication relies solely on cookies. If you can connect from a foreign origin using the victim's cookies and receive data or perform actions, that confirms the issue. Use a generic WebSocket client to replay the handshake with the victim's cookies and observe the responses.

    Seen in 3 reports
  4. Look for sensitive data in WebSocket messages. Connect from a cross-site page and see if the server sends chat history, session identifiers, password reset tokens or other private information. This demonstrates impact beyond just establishing a connection.

    Seen in 3 reports
  5. Try to perform state-changing actions over the hijacked socket. Send messages that edit documents, change settings or invite users. If the server accepts them, you have a strong proof of concept.

    Seen in 3 reports
View all 13

Guides and techniques

The best explainers, cheat sheets and technique posts on Cross-site WebSocket hijacking, from around the web.

Keep learning

Where this lesson fits, and what to read next.

How this is made: our model read every listed Cross-site WebSocket hijacking report in the index (our own summary where we have one, otherwise the title and the platform's label), listed the patterns, and merged them. Each point was kept only if the reports it cites exist, are listed and belong here; payouts are computed from the data, not written by the model. Read the originals before relying on a point. Generated 27 Nov 2026 from 39 reports. All Cross-site WebSocket hijacking reports.