DedSec Security Research ·
Here is a hypothetical. A dynamic scan of a web application that pushes live updates over WebSockets returns three results about them.
The first, rated high, is "WebSocket accepts arbitrary Origin" on wss://app.example/ws/notifications. The scanner sent the opening handshake with Origin: https://evil.example and the server answered 101 Switching Protocols. The second is the same finding on /ws/prices, also a 101. The third is informational, "WebSocket Origin validated", on /ws/account: the same foreign Origin got 403 Forbidden, and the team records that socket as protected.
As elsewhere in this series, each decision rests on a status code rather than on what the status code proves. In our lab, built to reproduce the three shapes, the first socket trusted a session cookie set with SameSite=Lax. A page on another site opened it and got 101 every time, but the browser never attached the cookie, so the socket answered "unauthenticated" and gave the page nothing of the victim's. A page on a sibling subdomain got the cookie, the victim's identity and the victim's data. The second socket authenticated with a token sent in the first message, so it accepted handshakes from anyone without giving anything away. And the "validated" socket, whose session cookie was SameSite=None, compared the Origin with startswith, so a page on app.lab.test.attacker.example got 101, the victim's session, and everything the socket would tell the victim.
This post is for whoever is holding a WebSocket finding from a dynamic scan, or a clean result they are about to rely on. It covers:
101 is the first rung, not the proofnull, a missing Origin, Fetch Metadata, and a check on the HTTP route that never runs on the upgradeIt belongs to our series on confirming DAST findings; the series guide sets out the evidence classes the series uses. The CSRF post is the nearest neighbour: a handshake is a cross-site request with the browser's cookies attached, and that post measured SameSite in one of the same browser builds. The CORS post matters because WebSockets are not governed by CORS, and one ticket design below fails through a CORS policy. The dangling DNS post covers how an attacker comes to hold a sibling subdomain, which decided most of the outcomes below.
How we tested. Everything ran on 22 November 2026 on a virtual machine with two vCPUs, Ubuntu 24.04.4 and kernel 6.8.0, as an unprivileged user, with every server bound to 127.0.0.1 and nothing installed. The application, the attacker pages and an attacker listener were one HTTPS server in Python 3.12.3's standard library, with the RFC 6455 opening handshake and framing written by hand, and a self-signed certificate. The browser mapped six hostnames to 127.0.0.1 with a host-resolver rule, and nothing else resolved: app.lab.test is the application, evil.lab.test is a sibling subdomain and therefore same-site, attacker.example is cross-site, and app.lab.test.attacker.example, attackerlab.test and app-lab.test exist to defeat particular Origin checks. Everything ran on port 8443, so every origin here carries :8443.
The browsers were Google Chrome for Testing 153.0.8010.12, the build the CSRF post used, and Chromium 156.0.8078.79, the binary from the chromium snap, run directly. Both ran headless, driven by Playwright 1.62.1, already on the machine. In each attempt the victim, Alice, was logged in; the attack page opened the socket, asked who it was talking to, asked for Alice's notes, tried to add a note, and posted everything it received to a listener on its own host. A second user, Mallory, is the attacker's own account. Every cell ran five times in each browser, so a cell is ten attempts: 2,120 browser attempts in all. Every cell gave the same result in all ten, and the two builds agreed on every cell. A scanner-style probe, a raw RFC 6455 client in Python, ran each of its cells five times, and a Node.js 22.22.2 test of the upgrade path ran five times.
One mistake is worth reporting because it is the topic. In the first smoke run, the server's copy of the RFC 6455 GUID had two two-digit groups swapped. The server logged 101 on all 16 handshakes, our raw client, which did not yet check Sec-WebSocket-Accept, read Alice's notes through it, and Chrome 153 failed all 16 connections (close code 1006); a debug run of the same build logged "Incorrect 'Sec-WebSocket-Accept' header value". A 101 in a log is not even proof that a browser can open the socket.
The servers are ours, written to be wrong in specific ways. This is not a measurement of any WebSocket library, framework, browser beyond the two builds named, or scanner, ours included. RFC 6455, the WHATWG WebSockets and Fetch standards, the W3C Fetch Metadata Working Draft, CWE-1385, two PortSwigger Web Security Academy pages and Christian Schneider's 2013 write-up were fetched on 22 November 2026, and every quotation below was checked against those copies.
A WebSocket starts as an HTTP GET with Upgrade: websocket. The WHATWG WebSockets Standard builds that request with its credentials mode set to "include", so the browser attaches the cookies it holds for the socket's host, subject to SameSite, whichever page called new WebSocket(). Nothing like CORS stands between the page and the socket afterwards: once the server answers 101, the page reads every message. Schneider, who described the attack in 2013, observed that the browser's usual fail-closed default for cross-origin responses "is inverted" for WebSockets, and concluded that "WebSockets are not protected by the Same-Origin Policy (SOP)".
What the browser does tell the server is where the page came from. RFC 6455 section 4.1 says the handshake "MUST include a header field with the name |Origin| ... if the request is coming from a browser client", and the Fetch Standard appends Origin to every request whose mode is websocket. Section 10.2 puts the decision on the server: servers "that are not intended to process input from any web page but only for certain sites SHOULD verify the |Origin| field is an origin they expect", and should answer 403 otherwise. Section 10.1 gives the limit: non-browser clients "can therefore send fake |Origin| header fields". Origin protects a user's browser from a hostile page, not the server from a hostile client.
CWE-1385, "Missing Origin Validation in WebSockets", is the classification. PortSwigger's Academy page describes the attack as a CSRF on the handshake that arises when it "relies solely on HTTP cookies for session handling and does not contain any CSRF tokens or other unpredictable values", with one difference from ordinary CSRF: "the attacker gains two-way interaction".
So an exploitable CSWSH is a conjunction:
101.A scanner that sends a handshake with a foreign Origin and gets 101 has evidence for the first point only, from a client that is not a browser.
| Evidence | What it shows | What it does not show |
|---|---|---|
101 to a foreign Origin from a raw client | The server did not refuse that string | That a browser would complete it or attach a cookie, or that a cookie authenticates the socket |
101 plus authenticated messages, cookie replayed by hand | The socket trusts the cookie | That a browser would send that cookie from the attacker's page |
| A test page opens the socket in a logged-in browser and the socket names the victim | Points 1 to 3, in that browser | What the socket can be used for |
| The victim's data arrives at a listener on the attacker's origin | Read impact, end to end | — |
| A victim-scoped change made from the attacker's page appears in the victim's account | Write impact, end to end | — |
The last two rows need two identities: a victim whose data is recognisably theirs, and an attacker who is someone else. A scanner logged in as one user that reads that user's data through a foreign-Origin socket has not shown that the data belongs to a victim, as the first-message results make concrete.
The first experiment removes every server-side defence: the socket checks no Origin and trusts the session cookie. Alice logs in with the cookie's SameSite attribute set to None, Lax, Strict, or left out, and a page in four positions opens the socket: the application itself as a control, the sibling, the cross-site host, and a sandboxed iframe on the cross-site host, which sends Origin: null. Each cell is "cookie sent / Alice's data at the attacker" out of 10 attempts; for the control, "at the attacker" means the page received it.
| Session cookie | Same-origin control | Sibling, evil.lab.test | Cross-site, attacker.example | Sandboxed iframe, Origin: null |
|---|---|---|---|---|
SameSite=None | 10 / 10 | 10 / 10 | 10 / 10 | 10 / 10 |
SameSite=Lax | 10 / 10 | 10 / 10 | 0 / 0 | 0 / 0 |
SameSite=Strict | 10 / 10 | 10 / 10 | 0 / 0 | 0 / 0 |
| No attribute | 10 / 10 | 10 / 10 | 0 / 0 | 0 / 0 |
All 160 handshakes got 101. In every attempt where Alice's data arrived, the page's "add a note" message also landed in her account, and in none of the others.
Only SameSite=None crossed a site boundary. From attacker.example and from the sandboxed iframe, a Lax, Strict or unset cookie never arrived; the socket still answered 101, and every request for notes came back "unauthenticated". Both builds' cookie stores reported the unset cookie as Lax, and treated it that way. The cross-site attempts started between 0.97 and 1.75 seconds after login. That is inside the two-minute window in which, in the CSRF post's measurement of Chrome 153, an unset cookie rode on a top-level cross-site POST, and the cookie was not sent. That exception, which the CSRF post measured, is for top-level POSTs; a handshake is not one.
The sibling got everything, Strict included. evil.lab.test and app.lab.test share a registrable domain, so for SameSite they are one site, and the sibling's page was treated exactly like the application's. Any subdomain an attacker can make serve a page, through a dangling DNS record, a user-content host or an XSS on a marketing site, defeated SameSite for the socket completely, in both builds.
Origin: null came with the None cookie. A sandboxed iframe has an opaque origin, which serialises as null, but the browser treated it as cross-site for cookies, so it got exactly what attacker.example got.
**No Sec-Fetch-* headers.** All 1,060 handshakes in Chrome 153 and all 1,060 in Chromium 156 carried Origin, and none carried any Sec-Fetch-* header, although the Fetch Metadata draft lists websocket as a valid Sec-Fetch-Mode value. As a control, the same builds sent Sec-Fetch-Site from pages on the same three hosts (the application, the sibling and attacker.example) on an ordinary fetch and an image request, same-origin, same-site or cross-site as appropriate, on 30 of 30 such requests per build, and on none of the 15 handshakes per build opened from those pages. We did not investigate why. The consequence is that a Fetch Metadata check, which the CSRF post found effective for forms, saw nothing on these handshakes.
Under Lax or Strict, then, a 101 to a foreign site's Origin was not a hijack in these builds unless the attacker had a page on a sibling. Under None, which an application embedded in other sites may need, the Origin check is the whole defence.
The second question is whether the socket trusts the cookie at all. Six designs, none checking Origin, attacked from the sibling and from attacker.example, with Alice's cookie None and then Lax:
POSTs to /api/ticket, which needs the cookie and sends no CORS headers, then connects to /ws/ticket?ticket=.... The server checks the ticket during the handshake and answers 403 without a valid one. Tickets are single-use and expire after 30 seconds.GET endpoint that reflects any Origin with Access-Control-Allow-Credentials: true.We also gave the first-message socket a token the attacker legitimately holds: Mallory's own. Each cell is the handshake status, the identity the socket used, and how many of 10 attempts got Alice's data to the attacker's listener.
| Socket | None, sibling | None, attacker.example | Lax, sibling | Lax, attacker.example |
|---|---|---|---|---|
| Cookie | 101, Alice, 10 | 101, Alice, 10 | 101, Alice, 10 | 101, nobody, 0 |
| First-message token, none sent | 101, nobody, 0 | 101, nobody, 0 | 101, nobody, 0 | 101, nobody, 0 |
| First-message token, Mallory's sent | 101, Mallory, 0 | 101, Mallory, 0 | 101, Mallory, 0 | 101, Mallory, 0 |
| First-message token, cookie fallback | 101, Alice, 10 | 101, Alice, 10 | 101, Alice, 10 | 101, nobody, 0 |
| Ticket, non-CORS endpoint | 403, 0 | 403, 0 | 403, 0 | 403, 0 |
| Ticket, CORS-reflecting endpoint | 101, Alice, 10 | 101, Alice, 10 | 101, Alice, 10 | 403, 0 |
| Public feed | 101, nobody, 0 | 101, nobody, 0 | 101, nobody, 0 | 101, nobody, 0 |
From the application's own origin, the cookie, fallback and both ticket sockets authenticated as Alice in 10 of 10 attempts with either cookie, so each design works for the legitimate page.
The first-message token made 101 meaningless. The socket accepted every handshake and returned nothing of Alice's, because nothing in the handshake identified her. A scanner flagging it for accepting a foreign Origin is right about the Origin and wrong about the risk. With Mallory's token, the attacker's page got an authenticated socket and Mallory's own notes in all 40 attempts from the sibling and attacker.example, as did the 20 same-origin controls. A scanner that holds one account and authenticates the socket with that account's token is in Mallory's position: it sees authenticated data at a foreign Origin, and the data is its own.
The fallback undid it. When the attacker's page simply sent no authentication message, the socket used the cookie, and the results matched the cookie socket in every cell. Testing a first-message design means testing what happens when the first message is not the expected one.
A ticket moves the question to the ticket endpoint. Against the non-CORS endpoint, the attacker's fetch of /api/ticket failed with "Failed to fetch" in every attempt, because the response carried no CORS headers, so the page connected without a ticket and got 403. Against the reflecting endpoint with a None cookie, the page read a fresh ticket and the socket was Alice's. With a Lax cookie, the request from attacker.example carried no cookie and got 401, so there was no ticket; from the sibling it carried the cookie, and the socket was Alice's again. The ticket is exactly as strong as the endpoint that hands it out.
A public feed is a 101 with nothing behind it. The finding is informational unless the feed accepts messages that change something.
The third experiment adds ten checks on the handshake, tried from the six attacker positions and the control, with the session cookie None and again Lax. The allowed origin is https://app.lab.test:8443. With SameSite=None, the table counts attempts, of 10, in which Alice's secret reached the attacker's listener.
| Check on the handshake | As written | Sibling | attacker.example | app.lab.test.attacker.example | attackerlab.test | app-lab.test | null |
|---|---|---|---|---|---|---|---|
| None | — | 10 | 10 | 10 | 10 | 10 | 10 |
| Exact | o == "https://app.lab.test:8443" | 0 | 0 | 0 | 0 | 0 | 0 |
| Substring | "lab.test" in o | 10 | 0 | 10 | 10 | 10 | 0 |
| Prefix | o.startswith("https://app.lab.test") | 0 | 0 | 10 | 0 | 0 | 0 |
| Suffix | o.endswith("lab.test:8443") | 10 | 0 | 0 | 10 | 10 | 0 |
| Suffix with a dot | o.endswith(".lab.test:8443") | 10 | 0 | 0 | 0 | 0 | 0 |
| Unanchored regex | re.search(r"https://app.lab.test", o) | 0 | 0 | 10 | 0 | 10 | 0 |
null allowed | exact, or o == "null" | 0 | 0 | 0 | 0 | 0 | 10 |
| Missing allowed | exact, or no Origin | 0 | 0 | 0 | 0 | 0 | 0 |
| Fetch Metadata only | refuse if Sec-Fetch-Site is present and not same-origin or none | 10 | 10 | 10 | 10 | 10 | 10 |
| Fetch Metadata, then Origin | as above; exact Origin if Sec-Fetch-Site is absent | 0 | 0 | 0 | 0 | 0 | 0 |
The application's own page authenticated as Alice through every check, in 220 of 220 attempts. Wherever Alice's data reached the attacker, the attacker's "add a note" also landed in her account, and nowhere else.
Exact comparison held everywhere, and so did the two checks that reduced to it in these browsers: "missing allowed", because the browser always sent an Origin, and "Fetch Metadata, then Origin", because with no Sec-Fetch-Site it always fell through to the exact comparison.
Substring on the domain, the "anything of ours" check, admitted the sibling and every host containing the string, including attackerlab.test and app-lab.test, which are registrable domains in their own right. It refused attacker.example only because that name lacks the string. CWE-1385's observed examples include CVE-2018-6651, a gaming client that "attempts to validate the Origin header, but only uses a substring", there in the other direction: an origin whose hostname is a substring of the valid one.
Prefix admitted app.lab.test.attacker.example, a subdomain of the attacker's own domain. It is the shape Schneider's post suggests testers try: when the server expects https://www.some-trading-application.com, "mount your attacks on" https://www.some-trading-application.com.some-evil-attacker-application.com.
Suffix without a dot admitted the sibling and two other people's domains, because attackerlab.test and app-lab.test both end in lab.test:8443. The dot closed both and left the sibling, which is what a dot-suffix check means: every subdomain is trusted.
The unanchored regular expression failed twice. Unescaped dots match any character, which let app-lab.test in, and with no $ the pattern matched the start of app.lab.test.attacker.example.
null allowed, usually a concession to local files or a development tool, admitted the sandboxed iframe, and the None cookie came with it.
Fetch Metadata only admitted everything. It treats a request without Sec-Fetch-Site as a non-browser client, and no handshake carried one.
With SameSite=Lax, the bypass hosts got nothing. Each bypass host is on a different registrable domain from lab.test, so the browser withheld the Lax cookie. Of the 190 attempts from cross-site positions that got 101 under Lax, none received anything of Alice's. What still worked under Lax was every check that admitted the sibling: none, substring, suffix with or without the dot, and Fetch Metadata only. An Origin-check bypass and a SameSite bypass are different findings, and a cross-site hijack needs both, or a sibling.
nullA check that passes a handshake with no Origin looks like a bypass, and our probe confirmed it: no Origin, 101. But all 2,120 browser handshakes carried an Origin, as RFC 6455 section 4.1 requires, including the 260 from sandboxed iframes, which sent the literal string null. No handshake from either of our builds lacked Origin, and RFC 6455 section 4.2.1 says such a handshake "SHOULD NOT be interpreted as coming from a browser client". A proxy that strips Origin, which we did not test, would change that. Allowing a missing Origin is worth fixing, because it makes the check depend on the client's manners, but on its own it is not a cross-site hijack. Allowing the string null is, when the session cookie is SameSite=None: any page can produce null with a sandboxed iframe, and ours did, with the None cookie attached.
The bypass that needs no clever hostname is a check that is not on the upgrade path. In Node.js's core http module, when an upgrade listener exists, a request with Upgrade: websocket goes to that listener and not to the request handler. We put an Origin check in the request handler of a Node.js 22.22.2 server and completed handshakes in its upgrade listener. A plain GET with a foreign Origin got 403 in 5 of 5 trials; an upgrade with the same Origin got 101 in 5 of 5, and the request handler was called zero times for upgrades. With the check moved into the upgrade listener, the foreign upgrade got 403 in 5 of 5. HTTP middleware, a CSRF filter that inspects only unsafe methods, or a gateway rule scoped to /api/* can all have the same shape: a handshake is a GET, and it may not go where your other requests go.
The probe does what a check outside a browser can: send the handshake with a chosen Origin or none, with no cookie or with Alice's Lax cookie attached by hand, and read what comes back. A scan can only probe a socket it has found, and a socket that a page opens from script after login is the kind of surface the crawler-coverage post is about. It ran against every socket, five times per cell, with the same answer each time.
| Socket | Probe from attacker.example | Probe with Alice's Lax cookie replayed: her notes? | Browser, None cookie: attacker origins that got Alice's data | Browser, Lax cookie |
|---|---|---|---|---|
| No check, cookie | 101 | yes | all six | sibling |
| Exact | 403 | no | none | none |
| Substring | 403 | no | sibling and three bypass hosts | sibling |
| Prefix | 403 | no | app.lab.test.attacker.example | none |
| Suffix | 403 | no | sibling, attackerlab.test, app-lab.test | sibling |
| Suffix with a dot | 403 | no | sibling | sibling |
| Unanchored regex | 403 | no | app.lab.test.attacker.example, app-lab.test | none |
null allowed | 403 | no | sandboxed iframe | none |
| Missing allowed | 403 | no | none | none |
| Fetch Metadata only | 101 | yes | all six | sibling |
| Fetch Metadata, then Origin | 403 | no | none | none |
| First-message token | 101 | no | none | none |
| First-message token, cookie fallback | 101 | yes | sibling, attacker.example | sibling |
| Ticket, non-CORS endpoint | 403 | no | none | none |
| Ticket, CORS-reflecting endpoint | 403 | no | sibling, attacker.example | sibling |
| Public feed | 101 | no | none | none |
"All six" means the sibling, attacker.example, the three bypass hosts and the sandboxed iframe. Given the right Origin string, the probe also got 101 through each bypass.
101 to a foreign Origin, no hijack. The probe got 101 from attacker.example on five of the sixteen sockets. With Alice's cookie Lax, none of the five gave a cross-site page anything of hers, and the first-message socket and the public feed gave no attacker page anything of hers with either cookie.
A replayed cookie overstates what a browser sends. With Alice's Lax cookie attached by hand, the probe read her notes through the cookie socket at Origin: https://attacker.example:8443. A browser at that Origin never sent the cookie. A replay that attaches a cookie the browser would withhold tests the server, not the attack; it is the CSRF post's curl-replay trap in the other direction.
403 to one foreign Origin, hijack anyway. Nine of the ten Origin checks refused the probe's attacker.example. Six of those nine still let Alice's data out to another attacker origin with a None cookie, and three did with Lax, all through the sibling. The CORS-ticket socket refused every probe, which had no ticket, while a page in the browser fetched one and read Alice's notes. A probe with one foreign Origin can only find "no check at all".
The procedure is general practice. It needs authorisation for the target and test accounts you control, and the proof should read or change something harmless on your own test account.
Sec-WebSocket-Protocol value, or an authentication message after the open. Remove each in a replay and see which the server needs.Set-Cookie, not the cookie store, which reported a missing SameSite attribute as Lax in both builds: SameSite, Domain, and any __Host- prefix.https://app.example.com.attacker.test), your domain ending in the allowed one (https://attackerapp.example.com), a character in place of each dot, null, no Origin, a sibling subdomain, http:// and a different port. Check the Sec-WebSocket-Accept value too.None cookie for a cross-site test, any cookie for a same-site one.Origin the server logged, and what reached the listener.| Change | Held against | Did not hold against |
|---|---|---|
| Exact Origin comparison, on the upgrade | all six attacker positions, with either cookie | — in our tests |
| Substring, prefix, suffix, unanchored regex | attacker.example | at least one bypass host each, and the sibling for substring and suffix |
| Suffix with a leading dot | every other registrable domain | the sibling |
Allowing null | — | a sandboxed iframe on any site |
Allowing a missing Origin, otherwise exact | every browser attempt | a non-browser client, or a proxy that drops Origin (not tested) |
| Fetch Metadata check alone | nothing: handshakes carried no Sec-Fetch-* | every attacker position |
| Origin check in the HTTP request handler only | a plain GET | every upgrade |
Session cookie SameSite=Lax or Strict | every cross-site page, in both builds | the sibling |
| First-message token, no cookie fallback | every attacker page without the victim's token | — in our tests |
| First-message token with cookie fallback | — | everything the cookie socket lost to |
| Single-use ticket from an endpoint with no CORS headers | every attacker position | — in our tests |
| Ticket from a CORS-reflecting endpoint | attacker.example under Lax | the sibling under either cookie, any site under None |
What the held rows share:
Lax or Strict, as defence in depth. It stopped every cross-site attempt in both builds, and nothing from a sibling.Much of this is visible in code. Find the handshake handler: in Node.js an upgrade listener or a library's origin-verification hook, in other stacks the route or consumer that accepts the connection. Look at what it does with Origin: nothing, includes, indexOf, startsWith, endsWith, a regular expression built from the domain without anchors or escaped dots, or a list containing null or treating an empty value as allowed. Check whether the Origin check lives in HTTP middleware the upgrade never reaches. Then follow how the connection gets its user, and whether a missing authentication message falls back to the session. Static analysis finds the places; a browser shows whether the deployment's cookies and subdomains make them exploitable. The SAST false-positive post describes the general trap of matching a pattern without checking the condition that makes it dangerous.
| Question | If the answer is no or unknown |
|---|---|
| Did a browser complete the handshake, not just a raw client? | With a wrong Sec-WebSocket-Accept, 16 logged 101s were 16 refused connections |
| Does the socket authenticate by the cookie at all? | A first-message socket gave 101 to every page and nothing of the victim's |
What does the session cookie's Set-Cookie say about SameSite? | Lax, Strict and unset cookies reached a cross-site handshake in 0 of 60 attempts |
| Can any sibling subdomain serve an attacker's page? | The sibling got even the Strict cookie, in 10 of 10 |
| Was the Origin check probed with more than one value? | Six of nine checks that refused attacker.example leaked elsewhere with a None cookie |
Is null accepted? | A sandboxed iframe read the victim's data in 10 of 10 |
| Does the check run on the upgrade itself? | Node's request handler ran 0 times for upgrades |
Does the defence depend on Sec-Fetch-*? | 0 of 2,120 handshakes carried one |
| If a cookie was replayed, would a browser have sent it? | The replayed Lax cookie read the victim's notes; no cross-site browser sent it |
| What happens when the first message is not an authentication message? | The fallback socket matched the cookie socket in every cell |
| Can another origin read the ticket endpoint? | A CORS-reflecting endpoint let attacker.example in, 10 of 10, under None |
| Is the data at the listener the victim's, from a second identity? | The attacker's own token returned the attacker's own notes, 40 of 40 from attacker pages |
What is cross-site WebSocket hijacking? A page on another site opens a WebSocket to your application in the victim's browser. The browser attaches the victim's cookies to the handshake, and if the server accepts it and trusts the cookie, the page can send messages as the victim and read every reply. It is CWE-1385, "Missing Origin Validation in WebSockets".
Does a 101 response to a foreign Origin prove cross-site WebSocket hijacking? No. It shows the server did not refuse that Origin string. In our lab, sockets that answered 101 to every Origin gave an attacker page nothing of the victim's when the session cookie was SameSite=Lax and the page was cross-site, when a first-message token authenticated the socket, or when it served only public data. Confirmation is the victim's data at a listener on the attacker's origin, or a victim-scoped change made from it.
Does SameSite=Lax prevent cross-site WebSocket hijacking? From cross-site pages in Chrome 153 and Chromium 156, a Lax, Strict or unset session cookie was never sent on the handshake. From a sibling subdomain it always was, Strict included, because SameSite is about sites, not origins. Other browsers and cookie settings were not tested.
Do browsers always send the Origin header on a WebSocket handshake? RFC 6455 section 4.1 requires browser clients to, and all 2,120 handshakes from our two Chromium builds carried one; a sandboxed iframe sends null. Section 4.2.1 says a handshake lacking it "SHOULD NOT be interpreted as coming from a browser client".
Does CORS protect WebSockets? No. CORS decides whether a page may read an HTTP response. Once a WebSocket server answers 101, the page reads every message, and no Access-Control-* header is involved. The server has to check Origin itself, which RFC 6455 section 10.2 says it SHOULD when it serves only certain sites.
Can Fetch Metadata headers protect a WebSocket endpoint? Not in the two builds we tested: none of 2,120 handshakes carried a Sec-Fetch-* header, though ordinary requests from pages on the same hosts did. A check that refuses only when Sec-Fetch-Site says cross-site let every attacker page in.
What is the fix? Compare the handshake's Origin with an exact list of your own origins, in the code that handles the upgrade, and answer 403 otherwise. Then stop the cookie being the socket's only credential: a first-message token or a short-lived single-use ticket that another origin cannot read, with no fallback to the cookie.
Our own toy servers and two headless Chromium builds, and nothing else. Not tested: Firefox, Safari, any other Chromium-based browser or version, or a headed browser; a profile that restricts or partitions third-party cookies, which may keep a None cookie off a cross-site handshake; any browser restriction on public pages reaching private or loopback addresses, because every lab host resolved to 127.0.0.1; plain ws://; WebSockets over HTTP/2 and HTTP/3 (RFC 8441 and RFC 9220); a token in Sec-WebSocket-Protocol; HTTP authentication or client certificates as the credential; any WebSocket library, framework or gateway, including Socket.IO and its long-polling fallback; proxies or load balancers that rewrite or drop Origin; authorisation after the open, idle timeouts and sockets that outlive a logout; injection through messages; and any scanner, ours included. We did not measure where the two-minute boundary for unset cookies falls.
/ws/notifications. Read the session cookie's Set-Cookie. With SameSite=Lax, a cross-site page got 101 and an unauthenticated socket in every attempt in both builds, so as a cross-site hijack it does not stand. List the sibling subdomains: if any can be made to serve a page, run the proof from there, where the same socket handed over the victim's identity and data every time. Fix the Origin check either way./ws/prices. Find out what authenticates the socket. Behind a first-message token with no fallback, a foreign page got 101 and nothing of the victim's, and the attacker's own token got the attacker's own data. Rate it on the Origin check alone, after testing the fallback./ws/account. One foreign Origin got 403. Run the list in step 4: our prefix check refused attacker.example and admitted app.lab.test.attacker.example, and with a None cookie that page read the victim's notes in every attempt. Ask for the code, and replace the check with an exact comparison on the upgrade.AppSecD's dynamic and API testing runs Nuclei, Dalfox, SQLMap, Commix, Katana, Arjun, FFuf and Interactsh for out-of-band detection, plus 150+ native checks and API discovery across 50+ web frameworks. Its policy-driven gating blocks a pull request or commit when it introduces a violation. Findings are deduplicated across scans, move through new, reopened and fixed states, and can require maker-checker approval before they are closed.
That is the whole claim. data/products.ts is the single source of truth for what these products do, and it does not mention WebSockets, the Origin header, cross-site WebSocket hijacking, SameSite or cookie attributes. So this post makes no claim that AppSecD tests for any of them. Nor does it claim anything about:
Origin values, or whether it checks Sec-WebSocket-AcceptThe mechanisms, measurements, confirmation procedure, fixes and checklist above are general practice that applies to any scanner's output, ours included. The scenario in this post is hypothetical and does not describe any deployment, user or finding.