Core/Auth: Mitigate DoS attacks to authserver
Mitigate DoS attacks to authserver like "Wow Auth Flooder.exe" by allowing a finite number of AUTH_LOGON_CHALLEGE packets in a row from same socket, 3 sounds like a reasonable limit.
This commit is contained in:
1 parent
0177d1c4d4
commit
03657525ad
1 file changed
+13
@@ -222,12 +222,25 @@ void AuthSocket::OnClose(void)
|
||||
// Read the packet from the client
|
||||
void AuthSocket::OnRead()
|
||||
{
|
||||
#define MAX_AUTH_LOGON_CHALLENGES_IN_A_ROW 3
|
||||
uint32 challengesInARow = 0;
|
||||
uint8 _cmd;
|
||||
while (1)
|
||||
{
|
||||
if (!socket().recv_soft((char *)&_cmd, 1))
|
||||
return;
|
||||
|
||||
if (_cmd == AUTH_LOGON_CHALLENGE)
|
||||
{
|
||||
++challengesInARow;
|
||||
if (challengesInARow == MAX_AUTH_LOGON_CHALLENGES_IN_A_ROW)
|
||||
{
|
||||
TC_LOG_WARN(LOG_FILTER_AUTHSERVER, "Got %u AUTH_LOGON_CHALLENGE in a row from '%s', possible ongoing DoS", challengesInARow, socket().getRemoteAddress().c_str());
|
||||
socket().shutdown();
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
size_t i;
|
||||
|
||||
// Circle through known commands and call the correct command handler
|
||||
|
||||
Reference in new issue
Block a user