Web Sockets: Web Socket Protocol

OtherExploitation

From PayloadsAllTheThings by Swissky and contributors, under the MIT licence. Shown as written; the title and classification are ours. Licences. Its authors can have this tip removed by writing to abuse@bugbountytips.org.

WebSockets start as a normal HTTP/1.1 request and then upgrade the connection to use the WebSocket protocol.

The client sends a specially crafted HTTP request with headers indicating it wants to switch to the WebSocket protocol:

http
GET /chat HTTP/1.1
Host: example.com:80
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==
Sec-WebSocket-Version: 13

Server responds with an HTTP 101 Switching Protocols response. If the server accepts the request, it replies like this.

http
HTTP/1.1 101 Switching Protocols
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Accept: s3pPLMBiTxaQ9kYGzzhZRbK+xOo=

Comments

No comments yet.