thinQmaster Virtual testing partner Adaptive practice exams that find your weak spots and drill them. Every answer explained. From $69
Enroll

thinQmaster

Find your exam

Five questions free, before you decide.

Step 1 · choose a vendor

In one of our camps? Your practice exams come with the tuition — they are on your study page already.

Application & OT Security · Advanced

Cross-Site WebSocket Hijacking (CSWSH)

A CSRF-like attack in which a malicious site opens a WebSocket to a target using the victim's cookies.

Definition

The WebSocket handshake is an HTTP request that carries cookies, and browsers do not apply SOP to it. If the server does not check the Origin header or use a token, the attacker's page can send and read messages as the victim. Mitigations: validate Origin, use per-session tokens and SameSite cookies.

Example

A chat app accepts WebSocket connections from any origin and authenticates only via cookies.

Exam tip

Validate the Origin header during the WebSocket handshake.

Related terms