17推论坛

标题: discuz出现“您当前的访问请求当中含有非法字符,已经被系统拒绝”解决方案 [打印本页]

作者: 执笔    时间: 2016-7-6 12:09
标题: discuz出现“您当前的访问请求当中含有非法字符,已经被系统拒绝”解决方案
(, 下载次数: 25)
相信这种问题discuz站长遇到的也很多,下面就来说下出现了这个问题还如何解决

解决方案
查找source\class\discuz的discuz_application.php文件
  1. private function _xss_check() {

  2.                 static $check = array('"', '>', '<', '\'', '(', ')', 'CONTENT-TRANSFER-ENCODING');

  3.                 if(isset($_GET['formhash']) && $_GET['formhash'] !== formhash()) {
  4.                         system_error('request_tainting');
  5.                 }

  6.                 if($_SERVER['REQUEST_METHOD'] == 'GET' ) {
  7.                         $temp = $_SERVER['REQUEST_URI'];
  8.                 } elseif(empty ($_GET['formhash'])) {
  9.                         $temp = $_SERVER['REQUEST_URI'].file_get_contents('php://input');
  10.                 } else {
  11.                         $temp = '';
  12.                 }

  13.                 if(!empty($temp)) {
  14.                         $temp = strtoupper(urldecode(urldecode($temp)));
  15.                         foreach ($check as $str) {
  16.                                 if(strpos($temp, $str) !== false) {
  17.                                         system_error('request_tainting');
  18.                                 }
  19.                         }
  20.                 }

  21.                 return true;
  22.         }
复制代码


替换为:

  1. private function _xss_check() {
  2.                 $temp = strtoupper(urldecode(urldecode($_SERVER['REQUEST_URI'])));
  3.                 if(strpos($temp, '<') !== false || strpos($temp, '"') !== false || strpos($temp, 'CONTENT-TRANSFER-ENCODING') !== false) {
  4.                         system_error('request_tainting');
  5.                 }
  6.                 return true;
  7.         }
复制代码


后台更新下缓存,看看是不是已经解决了该问题






欢迎光临 17推论坛 (https://bbs.17tui.cc/) Powered by Discuz! X3.4