故障描述:
* f! w8 n) v7 G. L
退出登录时出现”您当前的访问请求当中含有非法字符,已经被系统拒绝“错误。
( `- v$ l: H- ^. t8 S% t解决方法:
9 r: d0 u- I" H9 O& U% @打开 sourceclassdiscuzdiscuz_application.php 文件
- O2 j. z' s0 Q: o
找到
0 Q1 Y3 g4 h/ @! E8 Z' O
private function _xss_check() {
: w) U3 K6 w1 a8 t& n
8 t, t" D% x2 _$ n2 {" r0 {4 X static $check = array('"', '>', '<', ''', '(', ')', 'CONTENT-TRANSFER-ENCODING');
/ i5 c. H% U" p) U# U2 S& H
: D J7 Z* N! o1 o( }' x" J4 R if(isset($_GET['formhash']) && $_GET['formhash'] !== formhash()) {
: w& K) u# }3 i
system_error('request_tainting');
, E% G! p. m0 r }
, Y! Y# ] y) W8 s
' u5 X8 Q( P5 g: ^2 {& t if($_SERVER['REQUEST_METHOD'] == 'GET' ) {
8 N# p1 `/ G, C$ i $temp = $_SERVER['REQUEST_URI'];
$ u* s$ h: Y0 k& ^6 [3 t: }
} elseif(empty ($_GET['formhash'])) {
3 Z) d* e" D6 F" _* Y& `
$temp = $_SERVER['REQUEST_URI'].file_get_contents('php://input');
7 O$ t( }- S* N4 O; H
} else {
% w( V* I' G3 i. j; }9 \/ H
$temp = '';
7 u/ v% z# L: y+ g+ u) I }
' C7 H) a0 y1 O) e/ \
2 Q9 g2 @) f9 r6 N6 Q; f4 N if(!empty($temp)) {
# ]0 U6 m" q; ^$ `# C% | $temp = strtoupper(urldecode(urldecode($temp)));
" L: H( W8 m, m$ F foreach ($check as $str) {
1 _5 U7 C: S) Q# g) g if(strpos($temp, $str) !== false) {
/ V3 k. z2 E: a2 c% L1 ]/ k P
system_error('request_tainting');
- A/ p- e$ Y3 V7 V
}
1 m1 I8 C: G* Q8 K+ m7 u1 h
}
: z" y0 f7 X" g, C
}
* V w3 Q/ e3 j+ s7 q$ M) j8 f1 P
* z, u8 m' s( p2 Q9 X0 c
return true;
+ ?% z; H8 P+ h2 l}
6 U9 E. ^8 w; Z& \. [
修改为
- U2 f6 y- D8 {9 a7 [# Y
private function _xss_check() {
; ^" v- c+ t% m) T+ k( `
$temp = strtoupper(urldecode(urldecode($_SERVER['REQUEST_URI'])));
, M5 P/ w) N( I. a
if(strpos($temp, '<') !== false || strpos($temp, '"') !== false || strpos($temp, 'CONTENT-TRANSFER-ENCODING') !== false) {
3 E; J7 m, R" \$ k, {, J system_error('request_tainting');
7 k7 f3 X5 T& m- G# }( \ W
}
4 |6 [ W% C1 [* v return true;
g+ o, x- y1 G1 X}
( z/ P- k! f/ g