Skip to content
CSRF Write-up Intermediate

$7,000 for a Handshake Nobody Checked: Cross-Site WebSocket Hijacking

The WebSocket handshake endpoint authenticated only via the session cookie and did not validate the Origin header, so any external page could open an authenticated connection on a victim's behalf. An attacker could silently read live support chat messages from a logged-in user who visited a malicious page.

T4nv1 Follow

Published on medium.com

WebSocket connections authenticate differently from ordinary HTTP requests in a way that’s easy to overlook if you’re used to thinking about auth purely in terms of tokens and cookies. The initial handshake that upgrades an HTTP connection into a WebSocket still rides on an ordinary HTTP request, cookies and all —…

T4nv1, on medium.com

The full write-up lives on its author's site

It belongs to its author, so we link to it rather than copy it. The other two tabs are our own rewrites, checked against it.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

How it worked

Root cause

The WebSocket upgrade endpoint authenticated purely via the session cookie automatically attached to the handshake request, without validating the request's Origin header against an allowlist of legitimate application origins.

Impact

Any user visiting a malicious page while authenticated has their live support chat session silently exposed, potentially revealing account details and order information, with no interaction beyond normal browsing.

What the attacker needed

Victim logged in to the target; victim visits attacker-controlled page; attacker hosts a page

The fix

The endpoint was fixed by adding Origin validation to the WebSocket handshake against an explicit allowlist.

How it was found

  1. Open a support chat normally and capture the WebSocket handshake request in Burp.
  2. Note that the handshake carries the session cookie automatically.
  3. Build a minimal page on attacker-controlled infrastructure that attempts the same handshake from a different origin.
  4. Load the page in a browser already authenticated to the target in another tab.
  5. Observe that the handshake succeeds and live chat messages are pushed to the cross-origin connection.

Explained by bugbounty.wiki with AI from the original and checked against quotes from it; it can still be wrong. Read the original before relying on a detail.

Not written yet. The AI write-up for this write-up has not been written yet. The Original tab links to the source.

A WebSocket is a two-way live connection between a browser and a server, often used for chat. When the browser starts one, it automatically sends the user's login cookie, just like a normal request. If the server does not check which website asked for the connection, any other site the user visits can open one too and read the messages.

What is CSRF?

Another site makes a signed-in user's browser perform an action they did not intend.

More by T4nv1

View all

113 more disclosed reports, best first.

Similar reports

View all

Same bug class and techniques, clearest first.

Cross-site request forgery (CSRF)

The lesson behind this report.

Another site makes a signed-in user's browser perform an action they did not intend.