学习NO.1 发表于 2023-1-19 10:18:59

Discuz! System Error 您当前的访问请求当中含有非法字符,已经被系统拒绝错误解决

Discuz! X3.1和3.2 正式版含目前最新版在用户退出时偶尔会提示如下错误,特别是数据整合后的站点:

错误代码:
Discuz! System Error
您当前的访问请求当中含有非法字符,已经被系统拒绝
PHP Debug
search.php(discuz_application->init)
source\class\discuz\discuz_application.php(discuz_application->_init_misc)
source\class\discuz\discuz_application.php(discuz_application->_xss_check)
source\class\discuz\discuz_application.php(system_error)
source\function\function_core.php(discuz_error::system_error)
source\class\discuz\discuz_error.php(discuz_error::debug_backtrace)
临时解决方法:
修改 \source\class\discuz下的discuz_application.php文件大约第350行的private function _xss_check()方法:
private function _xss_check() {

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

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

if($_SERVER['REQUEST_METHOD'] == 'GET' ) {
$temp = $_SERVER['REQUEST_URI'];
} elseif(emptyempty ($_GET['formhash'])) {
$temp = $_SERVER['REQUEST_URI'].file_get_contents('php://input');
} else {
$temp = '';
}

if(!emptyempty($temp)) {
$temp = strtoupper(urldecode(urldecode($temp)));
foreach ($check as $str) {
if(strpos($temp, $str) !== false) {
system_error('request_tainting');
}
}
}

return true;
}为
private function _xss_check() {
$temp = strtoupper(urldecode(urldecode($_SERVER['REQUEST_URI'])));
if(strpos($temp, '<') !== false || strpos($temp, '"') !== false || strpos($temp, 'CONTENT-TRANSFER-ENCODING') !== false) {
system_error('request_tainting');
}
return true;
}

页: [1]
查看完整版本: Discuz! System Error 您当前的访问请求当中含有非法字符,已经被系统拒绝错误解决