[crossfire] The real cause of the metaserver DOS attack

Mark Wedel mwedel at sonic.net
Wed Jun 22 23:58:48 CDT 2005


Andreas Kirschbaum wrote:
>
     
      I'm fairly sure that the real cause of the metaserver DOS is not some
     
     >
     
      random attacker but the crossfire server itself: you just need to set up
     
     >
     
      a (new) crossfire server and change the "metaserver_notification off"
     
     >
     
      config option to "on" to make your server flood the metaserver.
     
     >
     
     
     >
     
     
     >
     
      The patch
     
     >
     
     
     >
     
          cvs diff -r 1.9 -r 1.10 lib/settings
     
     >
     
     
     >
     
      changed the default value for the "fastclock" config option from 0 to 1.
     
     >
     
      That probably means that many new servers will run in fastclock mode.
     
     >
     
     
     >
     
     
     >
     
      Furthermore, socket/loop.c contains a logic error if fastclock is
     
     >
     
      enabled:
     
     >
     
     
     >
     
      (excerpt from socket/loop.c; I stripped code not related to the problem)
     
     >
     
      | /** Waits for new connection */
     
     >
     
      | static void block_until_new_connection() {
     
     >
     
      |     do {
     
     >
     
      |         /* Every minutes is a bit often for updates - especially if
     
     >
     
      |          * nothing is going on. This slows it down to every 6 minutes.
     
     >
     
      |          */
     
     >
     
      |         cycles++;
     
     >
     
      |         if (cycles == 7) {
     
     >
     
      |             metaserver_update();
     
     >
     
      |             cycles=1;
     
     >
     
      |         }
     
     >
     
      |         if (settings.fastclock > 0) {
     
     >
     
      |             Timeout.tv_sec=0;
     
     >
     
      |             Timeout.tv_usec=50;
     
     >
     
      |         } else {
     
     >
     
      |             Timeout.tv_sec=60;
     
     >
     
      |             Timeout.tv_usec=0;
     
     >
     
      |         }
     
     >
     
      |     }
     
     >
     
      |     while (select([...], &Timeout)==0);
     
     >
     
      [...]
     
     >
     
     
     >
     
      This function is called whenever a server has no active connections.
     
     >
     
      Basically, with fastclock=0, the metaserver update will be sent once per
     
     >
     
      6 minutes but with fastclock=1 it will be sent once per 6*50 usec (which
     
     >
     
      could be more than 3000 packets per second on a fast machine).
     
     
  Probably so.  Related, but limited to the local system, if fastclock is sent, 
the server will also send a ton of udp packets for the watchdog logic.  This is 
at least on the local system, but probably increases the load about.

  Real bug here was the commit of the settings files that changed the value of 
fastclock.  Unfortunately, changing the settings file back doesn't really help 
things out because by default, the settings file is not installed if one already 
exists - thus, all the people will broken settings file will continue to have it.

  I'll commit a fixed settings file and also work on some bug for the fastclock 
logic in that loop itself.



    
    


More information about the crossfire mailing list