故障描述:
4 b7 P5 [2 a( V% a: r6 V
退出登录时出现”您当前的访问请求当中含有非法字符,已经被系统拒绝“错误。
O8 @% b$ w( I* k0 Q5 E* D" E解决方法:
8 E8 D4 E2 l }% W打开 sourceclassdiscuzdiscuz_application.php 文件
$ ?+ c) A* g6 u, r- G, P
找到
0 r9 A, c% |. q2 C( o% @7 h0 `private function _xss_check() {
. E0 W |* X/ A8 \. s7 u
+ L f4 w7 q' R/ a: j, K static $check = array('"', '>', '<', ''', '(', ')', 'CONTENT-TRANSFER-ENCODING');
+ U- G) f" R$ }: H; t$ j
0 h' A4 m: B! c6 x3 J7 ^& | if(isset($_GET['formhash']) && $_GET['formhash'] !== formhash()) {
C: w: L& q1 |6 ^6 N system_error('request_tainting');
! B, r; ?: }$ P$ c1 Q3 v }
3 z5 [0 P% z, I3 l4 [0 R8 V0 w, Z, ^! |$ c' p7 Z8 [
if($_SERVER['REQUEST_METHOD'] == 'GET' ) {
' h6 a* ~; m, q# w $temp = $_SERVER['REQUEST_URI'];
# G- m) V5 v7 _8 I! M
} elseif(empty ($_GET['formhash'])) {
+ i( |8 P( g7 A$ b3 V8 t $temp = $_SERVER['REQUEST_URI'].file_get_contents('php://input');
2 S9 w% V1 ?1 a9 Q, H, j q3 b
} else {
3 b K, w% Y) J# U$ \ $temp = '';
' ~: f c1 R/ ?; H/ G( W5 k }
% ^4 M( ^! e* c3 }0 @& `6 I
; r$ ]& G) g" P( A/ l3 T; { if(!empty($temp)) {
4 M6 I! S a0 S $temp = strtoupper(urldecode(urldecode($temp)));
2 I4 G# r' h; l& _. B- O
foreach ($check as $str) {
0 ]5 b9 N, V, U3 m( N: x
if(strpos($temp, $str) !== false) {
0 j9 o) U; y0 d! v/ i1 k$ E& x system_error('request_tainting');
/ q& l3 v1 L0 }9 a" U3 M) `( ~
}
) B7 N1 {9 i. A- n
}
3 W4 E0 N8 H0 Q! m9 j& a" E }
" J2 h7 F* u( X5 G' l- ` s- m' m
9 |* V) n" @3 y W ?6 A return true;
! ~ d8 Q9 k% ]}
: b8 a* [! y1 h7 Q2 o- [6 g6 A修改为
6 {! {9 s9 q( a" q% J# t
private function _xss_check() {
; U! a- G% a: x) e$ b
$temp = strtoupper(urldecode(urldecode($_SERVER['REQUEST_URI'])));
7 N1 d. s5 I2 s Q! }! @9 R, U if(strpos($temp, '<') !== false || strpos($temp, '"') !== false || strpos($temp, 'CONTENT-TRANSFER-ENCODING') !== false) {
& d/ P5 x+ d( ]8 I$ k
system_error('request_tainting');
& A" H- v: F- d3 k; |/ G2 X }
7 d9 E- I Q& r9 N0 L
return true;
3 E8 r2 f; }2 \. n}
' H$ R; W5 K$ P' x/ r2 }