Author Topic: Default Admin Function Timeouts  (Read 1265 times)

Let's say I write a script that can do a few fairly simple things.

1.) It can tell if I have admin or not.
2.) It can tell if any Superadmins are on the server.
3.) It can get a list of all clients that are on the server and that are joining.


All of these are relatively simple things to do. Now I mate this up to an automatic banner.

Let's say a ban packet is sixteen bytes plus the length of its ASCII string.

The first byte is the packet type. In this case we'll say it's zero, for "command to server". Others could be "ping", "move", "trigger", so on.
The second and third bytes are a ushort representing the server command. In this case it's 'ban', which is 40.
The next four bytes are a presumably unsigned integer representing the object ID of the victim. We'll say it's 12345.
Then we have another integer, let's say it's signed this time, representing the Blockland ID of the victim. We'll say it's 11239.
The twelfth byte is the length of the victim's name, in this case 5.
Finally, we have another four bytes representing the ban time. Let's say it's -1 - which also means this one, at least, HAS to be a signed integer.

So here's what our final packet to ban that annoying Xalos might look like, in hexadecimal.
00 00 28 00 00 30 39 00 00 2B E7 05 58 61 6C 6F 73 FF FF FF FF

Let's take the worst case on the string and say that each player's name is 32 characters long. (The maximum displayed length for a server nameEDIT1 is 32, including host name, so that's where I'm getting this upper limit.) That means that we have 48 bytes per banned client. Multiplying 48 bytes byte 98 players (assuming a limit of 99 players and not banning ourselves), we get 4704 bytes, or ~4.6 kilobytes.

Assuming this host is working off a 56k modem (with 99 players?! WTF!!!), that means that I can ban every player on the server in roughly two thirds of a second - easily before any other admins can react to ban me. If I wrote the script to target admins first, then even slower network speeds could still be workable.


Now someone joins. My script instantly knows that they joined, and so bans them before they have time to even react. Any non-SAs are banned before they can ban me, meaning I can easily DoS a server by someone clicking the wrong button and giving me admin for what would have otherwise been only half a second.



TL;DR: We need a default timeout for bans.



Note that this post uses several assumptions, such as minimizing packet size for the /ban command but only to that of its (normal) userland arguments. If only the client ID were sent for clients which exist on the server, size could be reduced further. Since its arguments are actually transmitted as text, its actual size is probably much higher.
« Last Edit: October 30, 2013, 09:21:07 PM by Xalos »

Yeah it is definitely possible to cause some severe lag in servers by using a script that just goes along and bans every ID ever.  However, I think that is probably mostly because of how slow file IO is.

I don't know about having a timeout that is long enough for other admins to easily react to, however.  Sometimes it is necessary to ban a group of 3 or 4 users and sitting there for like 20 seconds between each ban is probably not great, but there should definitely be a way to stop automated script based mass bannings.

Yeah it is definitely possible to cause some severe lag in servers by using a script that just goes along and bans every ID ever.  However, I think that is probably mostly because of how slow file IO is.

I don't know about having a timeout that is long enough for other admins to easily react to, however.  Sometimes it is necessary to ban a group of 3 or 4 users and sitting there for like 20 seconds between each ban is probably not great, but there should definitely be a way to stop automated script based mass bannings.
Get better admins that you actually trust?

Get better admins that you actually trust?

I can easily DoS a server by someone clicking the wrong button and giving me admin for what would have otherwise been only half a second.

protip: if you tell the server that you don't have rtb, it will send you the auto admin list on request.
protip 2: normal admins can ban super admins while those aren't in the server

Get better admins that you actually trust?

Generally the penalty for mistrusting someone with admin is an upset server or a cleared build.  The penalty should not be a crashed/ddos'd server, however.

Generally the penalty for mistrusting someone with admin is an upset server or a cleared build.  The penalty should not be a crashed/ddos'd server, however.
how does the server crash from banning people

protip: if you tell the server that you don't have rtb, it will send you the auto admin list on request.
protip 2: normal admins can ban super admins while those aren't in the server

This hypothetical script just went from bad to worse.


inb4exists

function blop()
{
    while(%bl_id < 50000)
        commandtoserver('ban', "idk wtf the arguments are", %bl_id++, -1);
    schedule(0, 0, 'blop');  //oh god I haven't coded in so long I can't even remember things
}

lags the server to the point of crashing or your money back

function blop2()
{
     for(%a=0;%a<24;%a++)
          commandtoserver('listAllDatablocks');
     schedule(0,0,blop2);
}
the end

function blop2()
{
     for(%a=0;%a<24;%a++)
          commandtoserver('listAllDatablocks');
     schedule(0,0,blop2);
}
the end

The thing that really kills it for a server though is file IO.
Each time you send a ban command, the server has to read through the ban list and then append it I think, and file IO is really slow.  However, that one works even if you aren't admin I believe, so fair enough.

function blop2()
{
     for(%a=0;%a<24;%a++)
          commandtoserver('listAllDatablocks');
     schedule(0,0,blop2);
}
the end
that is gonna crash yourself

the end
don't post this it's highly abusive
that one works even if you aren't admin I believe, so fair enough.
luckily this only works for admins or higher

the problem with what marble posts is it's not traceable you'll just see loads of garbage in the console
« Last Edit: October 31, 2013, 09:17:21 AM by swollow »

that is gonna crash yourself
Tried it. All it did was make me lag a lot, and no one else.