### 简要描述:
20140718,无视360webscan,无需登录。
### 详细说明:
/lib/table/stats.php 13行getbot函数:
```
public static function getbot() {
$ServerName = $_SERVER["SERVER_NAME"];
$ServerPort = $_SERVER["SERVER_PORT"];
$ScriptName = $_SERVER["SCRIPT_NAME"];
$QueryString = $_SERVER["QUERY_STRING"];
$serverip = $_SERVER["REMOTE_ADDR"];
$GetLocationURL=self::geturl();
$agent1 = $_SERVER["HTTP_USER_AGENT"];
$agent=strtolower($agent1);
$Bot="";
if(strpos($agent,"googlebot")>-1) {
$Bot = "Google";
}
if(strpos($agent,"mediapartners-google")>-1) {
$Bot = "Google Adsense";
}
if(strpos($agent,"baiduspider")>-1) {
$Bot = "Baidu";
}
if(strpos($agent,"sogou")>-1) {
$Bot = "Sogou";
}
if(strpos($agent,"yahoo")>-1) {
$Bot = "Yahoo!";
}
if(strpos($agent,"msn")>-1) {
$Bot = "MSN";
}
if(strpos($agent,"soso")>-1) {
$Bot = "Soso";
}
if(strpos($agent,"iaarchiver")>-1) {
$Bot = "Alexa";
}
if(strpos($agent,"sohu")>-1) {
$Bot = "Sohu";
}
if(strpos($agent,"sqworm")>-1) {
$Bot = "AOL";
}
if(strpos($agent,"yodaobot")>-1) {
$Bot = "Yodao";
}
if(strpos($agent,"iaskspider")>-1) {
$Bot = "Iask";
}
if(strlen($Bot)>0 &&!front::get('admin_dir')) {
$stats = self::getInstance();
$insert = $stats->rec_insert(array('bot'=>$Bot,'url'=>$GetLocationURL,'ip'=>$serverip,'time'=>date('Y-m-d H:i:s')));
}
}
```
其中判断了user-agent,如果是robot的话,就将其信息插入数据库。
我们看到,插入了这四项:
array('bot'=>$Bot,'url'=>$GetLocationURL,'ip'=>$serverip,'time'=>date('Y-m-d H:i:s'))
其中$GetLocationURL来自self::geturl()函数,看看这个函数:
```
public static function geturl() {
if(!empty($_SERVER["REQUEST_URI"])) {
$scrtName = $_SERVER["REQUEST_URI"];
$nowurl = $scrtName;
}else {
$scrtName = $_SERVER["PHP_SELF"];
if(empty($_SERVER["QUERY_STRING"])) {
$nowurl = $scrtName;
}else {
$nowurl = $scrtName."?".$_SERVER["QUERY_STRING"];
}
}
return (isset($_SERVER["HTTPS"])&&$_SERVER["HTTPS"] == "on")?'https://':'http://'.$_SERVER['HTTP_HOST'].$nowurl;
}
```
直接取的$_SERVER['PHP_SELF']和$_SERVER['QUERY_STRING'],而$_SERVER并没有转义,造成了注入。
因为360webscanz只检测了$_GET、$_POST等变量,所以这里的注入无视360webscan。
### 漏洞证明:
向index.php发送如下数据包注入即可:
[<img src="https://images.seebug.org/upload/201407/22195931ce818a8f90b53f37e1ac5578ba3f160e.jpg" alt="05.jpg" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201407/22195931ce818a8f90b53f37e1ac5578ba3f160e.jpg)
首先得把user-agent设置成百度蜘蛛,然后注入部分放在url中即可。
记录下的执行的sql语句如下:
[<img src="https://images.seebug.org/upload/201407/22200916b5a9f84338f19f577dab4c328f083b4b.jpg" alt="04.jpg" width="600" onerror="javascript:errimg(this);">](https://images.seebug.org/upload/201407/22200916b5a9f84338f19f577dab4c328f083b4b.jpg)
我似乎没有在前台找到输出点,所以只能盲注了。具体代码我就不给了,盲注代码如下:
```
',(select/**/if((select/**/ord(substr(user(),1,1)))=114,sleep(3),0)),1)#
```
暂无评论