Discuz!x3.1故障描述:垃圾站博主发现升级Discuz! x3.1版本后,退出登录或以游客状态搜索时出现“您当前的访问请求当中含有非法字符,已经被系统拒绝”的错误。
解决方案如下:sourceclassdiscuz的discuz_application.php 查找
1 | private function _xss_check() { |
3 | static $check = array ( '"' , '>' , '<' , ''' , '(' , ')' , 'CONTENT-TRANSFER-ENCODING' ); |
5 | if (isset( $_GET [ 'formhash' ]) && $_GET [ 'formhash' ] !== formhash()) { |
6 | system_error( 'request_tainting' ); |
9 | if ( $_SERVER [ 'REQUEST_METHOD' ] == 'GET' ) { |
10 | $temp = $_SERVER [ 'REQUEST_URI' ]; |
11 | } elseif ( empty ( $_GET [ 'formhash' ])) { |
12 | $temp = $_SERVER [ 'REQUEST_URI' ]. file_get_contents ( 'php://input' ); |
18 | $temp = strtoupper (urldecode(urldecode( $temp ))); |
19 | foreach ( $check as $str ) { |
20 | if ( strpos ( $temp , $str ) !== false) { |
21 | system_error( 'request_tainting' ); |
替换为:
1 | private function _xss_check() { |
2 | $temp = strtoupper (urldecode(urldecode( $_SERVER [ 'REQUEST_URI' ]))); |
3 | if ( strpos ( $temp , '<' ) !== false || strpos ( $temp , '"' ) !== false || strpos ( $temp , 'CONTENT-TRANSFER-ENCODING' ) !== false) { |
4 | system_error( 'request_tainting' ); |