那爱 发表于 2022-1-17 20:43:44

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

故障描述退出登录时出现”您当前的访问请求当中含有非法字符,已经被系统拒绝“错误。

解决方案如下:
\source\class\discuz的discuz_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;
      }上传覆盖同名文件,后台更新缓存,重新登录退出看看是否解决了。

yuhan3440 发表于 2022-1-17 20:56:41

手机版回复没有金币了吗?

tj157198575 发表于 2022-1-18 00:04:06

膜拜神贴,后面的请保持队形~

cvsg04667 发表于 2022-2-5 17:50:14

哥顶的不是帖子,是寂寞!

nnn666 发表于 2022-2-23 13:53:21

55555555555555555555

ceshi 发表于 2022-3-23 11:12:46

啥也不说了,楼主就是给力!

lonely9856 发表于 2022-4-15 22:05:50

1111111111111111

a1091347787 发表于 2022-7-25 08:49:26

不错,又占了一个沙发!

gaohe3 发表于 2022-7-27 00:43:56

很感谢分享

wang86084 发表于 2022-7-31 18:15:41

aaaaaaaaaaaaaaaaaaaaaaaaaaaaa
页: [1] 2 3
查看完整版本: Discuz! 出现“您当前的访问请求当中含有非法字符“解决方法