小草根

dz x3.1 x3.2最新版未登录论坛搜索出现“您当前的访问请求当中含有非法字符“解决方法

作者:小草根   发布时间:2014-06-18 13:57   回复数:0   浏览数:815
小草根
8150小草根管理员
2014-06-18 13:57:30
8150 2014-06-18 13:57:30
dz x3.1 x3.2最新版未登录论坛搜索出现“您当前的访问请求当中含有非法字符“的解决方法



图片:1.jpg





解决方案如下:


\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;
        }
上传覆盖同名文件,后台更新缓存,重新登录退出看看是否解决了.


(修改前记得备份原文件!)
游客
登录后才可以回帖,登录 或者 注册