Cross-Site WebSocket Hijacking Exploitation in 2025
The article describes Cross-Site WebSocket Hijacking (CSWSH), where a malicious site can open a WebSocket to a victim site and read/write data using the victim's cookies because WebSockets bypass the Same Origin Policy. It presents three case studies and shows that browser mitigations like SameSite=Lax by default and Total Cookie Protection block some attacks, but CSWSH still works in default Chrome when cookies are SameSite=None and against private IP addresses.
blog.includesecurity.com
Published on blog.includesecurity.com
Some of my favorite findings discovered during our client assessments at Include Security have exploited Cross-Site Websocket Hijacking (CSWSH) vulnerabilities. However, going back through those past findings, I realize that some of them wouldn’t work today in all browsers.
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 server does not validate the Origin header of the handshake request, and the authentication cookie is set to SameSite=None, so the browser sends it on cross-site WebSocket connections.
Impact
An attacker could make arbitrary API calls, modify documents, delete accounts, or stream and configure camera devices, but only if the victim uses a browser that still sends the cookie cross-site (default Chrome for SameSite=None cookies, or any browser for private IPs).
What the attacker needed
Cookie-based authentication; cookie set to SameSite=None; no Origin validation on WebSocket server; victim visits attacker's site
The fix
The WebSocket server should check the Origin header of the handshake and reject requests from untrusted origins.
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.
WebSockets let a website keep a two-way conversation with your browser. Normally, a website from one domain cannot read data from another domain, but WebSockets are not covered by that rule. So a malicious site can open a WebSocket to your bank, and your browser will attach your bank cookies, letting the attacker act as you and read the replies.
What is CSRF?
Another site makes a signed-in user's browser perform an action they did not intend.