首页 > 技术 > cms教程

Discuz“您当前的访问请求当中含有非法字符“的解决方法

小编 cms教程 2024-04-01 16:41:21  
故障描述:
退出登录时出现"您当前的访问请求当中含有非法字符,已经被系统拒绝"错误。如下图:

Discuz“您当前的访问请求当中含有非法字符“的解决方法


解决方法:
打开 sourceclassdiscuzdiscuz_application.php 文件
找到
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(empty ($_GET['formhash'])) {
$temp = $_SERVER['REQUEST_URI'].file_get_contents('php://input');
} else {
$temp = '';
}

if(!empty($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;
}
版权声明

本文仅代表作者观点,不代表本站立场。
本文系作者授权发表,未经许可,不得转载。
本文地址:https://chcsas.com/ywkf/13628.html

加载中~

木星教程网

统计代码 | 湘ICP备19012813号-5

本网站LOGO受版权及商标保护,版权登记号:国作登字-2022-F-10126915,未经湖南木星科技官方许可,严禁使用。
Copyright © 2012-2022 湖南木星科技有限公司(木星网)版权所有
转载内容版权归作者及来源网站所有,本站原创内容转载请注明来源,商业媒体及纸媒请先联系:aishangyiwan@126.com

扫描微信二维码

关注我们可获取更多热点资讯