WebSockets
WebSocket connections are long-lived HTTP initiations allowing bidirectional messaging. The connection stays open until a message is sent by the client or server. WebSocket is ideal for low-latency and server-triggered messages, such as real-time financial data feeds.
Manipulating WebSocket connections
https://portswigger.net/web-security/websockets#manipulating-websocket-connections
WebSockets vulnerabilities
If inputs are transmitted and processed server-side
Server-side attacks (SQLi, XXE, etc.)
If attacker-controlled data is transmitted via WebSockets to other application users
Client-side attacks (XSS, etc.)
Example if the content of a message is transmitted to another user (via chat...)
{"message":"<img src=1 onerror='alert(1)'>"}
Also blind vulnerabilities
Cross-site WebSocket hijacking
An attacker can craft a malicious webpage on their domain, initiating a cross-site WebSocket connection to the susceptible application. (As CSRF, the websocket connection mustn't contain CSRF tokens)
Perform unauthorized actions masquerading as the victim user (like CSRF)
Retrieve sensitive data that the user can access.
Waiting for incoming messages to arrive containing sensitive data.
Exploitation code to open a websocket connection to send messages on your server
Last updated