Skip to content
CSRF Write-up Intermediate

SameSite Strict Bypass via Sibling Domain (CSWSH) — Practical W

A chat WebSocket endpoint sent the full chat history when a client sent a READY message, and its session cookie was set to SameSite=Strict. By finding a reflected XSS on a sibling subdomain of the same registrable domain, the attacker could run script that is treated as same-site, so the victim's cookie was sent and their chat history, including credentials, was exfiltrated.

PRiTi.EX Follow

Published on medium.com

I just solved a PortSwigger lab where I chained multiple vulnerabilities to take over a victim account. No heavy theory here just the real attack flow and payloads.

PRiTi.EX, 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

Likely the site relied on SameSite=Strict alone to stop cross-site WebSocket hijacking, without checking the Origin header on the WebSocket handshake, and a sibling subdomain had a reflected XSS that provided a same-site execution context.

Impact

An attacker could steal a victim's chat history, which contained their username and password, and then log in as them; the exploit depended on the victim visiting the attacker's page and on the sibling subdomain XSS being present.

What the attacker needed

Victim visits attacker page; reflected XSS on sibling subdomain; victim logged in to chat

How it was found

  1. Open the live chat and observe the WebSocket handshake and the READY message that returns chat history.
  2. Build a basic cross-site WebSocket hijacking proof of concept and confirm it only returns your own session.
  3. Notice the session cookie is not sent because it is SameSite=Strict.
  4. Find a sibling subdomain with a login form that reflects input and confirm script execution.
  5. Change the login request from POST to GET so the payload can be delivered via a URL.
  6. Host a page that redirects the victim to the sibling subdomain login URL carrying the encoded hijacking script, then read the exfiltrated chat history.

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 website can mark its login cookie as SameSite=Strict, which means the browser only sends it when the request comes from the same site. 'Same site' is judged by the shared root domain, not the exact subdomain, so a script running on one subdomain can still reach another subdomain with the cookie attached. Here a cross-site scripting flaw on a sibling subdomain gave the attacker a place to run script that counted as same-site.

What is CSRF?

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

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.