DOS Attack on our WS server, potential vulnerability? #5235
-
Hey, my & a few other websites has been hit by the following attack over the last few days. We've managed to retrieve the PoC from the person doing the attack & it's basically a ping flooding attack. What's happening?The attacker is using a pretty simple but effective method:
After a little bit, the WS server just dies. The obvious solution seems to be rate limiting pings per IP address, but that wasn't as straight forward as I had hoped (because the events for pings are not emitted in the same way as other pings). Is this considered a socket.io vulnerability? Or is this considered a regular DOS attack? The PoC we retrieved from the attacker:
|
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi! Yes, I'd say that counts as a regular DOS attack. You could catch the 'ping' messages in your application and close the connection: function listenToPing(socket) {
socket.on("ping", () => {
console.warn("unexpected ping");
socket.close();
});
}
io.engine.on("connection", (engineSocket) => {
if (engineSocket.transport.name === "websocket") {
listenToPing(engineSocket.transport.socket);
} else {
engineSocket.on("upgrade", (transport) => {
if (transport.name === "websocket") {
listenToPing(transport.socket);
}
})
}
}); I'm wondering whether we should include it in the library, as receiving |
Beta Was this translation helpful? Give feedback.
Hi! Yes, I'd say that counts as a regular DOS attack.
You could catch the 'ping' messages in your application and close the connection:
I'm wondering whether we should include it in the library, as receiving
ping
/pong
events is not really expected. Thoug…