pentesting, updated

Testing WebSockets

Check WebSocket origin validation, authentication and message handling for the same classes of bug as HTTP.

Goal

Confirm the WebSocket handshake validates Origin, requires authentication, and messages are treated as untrusted input.

How to test

Inspect the handshake and connect from an unexpected origin:

curl -s -i -N \
  -H "Connection: Upgrade" -H "Upgrade: websocket" \
  -H "Origin: https://evil.com" \
  -H "Sec-WebSocket-Key: $(openssl rand -base64 16)" \
  -H "Sec-WebSocket-Version: 13" \
  https://example.com/ws

Once connected, fuzz message content the same way you’d fuzz HTTP parameters (injection, oversized payloads, type confusion).

What to look for

A connection accepted from an arbitrary Origin (cross-site WebSocket hijacking), or a message handler trusting input without validation.

References

§ home
~/knubertus/home/
1,1 Top