解决DISCUZ各版本 用户退出时非法字符BUG!

2017-11-12 1986 0条评论

真的很无语,很怀念戴志康时代的DZ,虽然不是很智能,但是那时候的DZ细节做的真的很好,

而现在的DZ技术 到处都是BUG! 而且也不管不问不更新,


有很多的站长无论升级也好,新安装DZ的也罢,有很多人登录后退出会提示BUG!

Discuz! System Error

  • 您当前的访问请求当中含有非法字符,已经被系统拒绝

PHP Debug

  • [Line: 0026]member.php(discuz_application->init)

  • [Line: 0071]source\class\discuz\discuz_application.php(discuz_application->_init_misc)

  • [Line: 0558]source\class\discuz\discuz_application.php(discuz_application->_xss_check)

  • [Line: 0359]source\class\discuz\discuz_application.php(system_error)

  • [Line: 0023]source\function\function_core.php(discuz_error::system_error)

  • [Line: 0024]source\class\discuz\discuz_error.php(discuz_error::debug_backtrace)



下面我们来解决问题:


\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;
        }



OK 问题解决了!

文章版权及转载声明

本文作者:符文浩 网址:http://blog.fuwenhao.com/post/13.html 发布于 2017-11-12
文章转载或复制请以超链接形式并注明出处。

发表评论

快捷回复:

评论列表 (暂无评论,1986人围观)参与讨论

还没有评论,来说两句吧...

取消
微信二维码
微信二维码
支付宝二维码