52AV手機A片王|52AV.ONE

標題: 遊客站內搜尋的錯誤 [打印本頁]

作者: IT_man    時間: 2015-3-23 16:24
標題: 遊客站內搜尋的錯誤
本帖最後由 IT_man 於 2015-3-23 16:27 編輯
0 l& u6 q% O+ g4 N
- y8 h- r7 W% j% C# }% X' M2 }2 t遊客站內搜尋時出現 error message :
) e3 p6 M' h) f7 i" a* p  l9 b- S
- O) q, B2 F- A7 E/ b
$ K$ P& E3 \3 K: x7 C3 _9 M9 [. N, R3 ?' v9 a( [, _/ Z3 b, e
$ R9 ^, a5 y; [& D) d& ~) ~$ F
sol:$ M6 k1 Q% g" A8 @/ h) j6 n0 \6 Y7 U
\source\class\discuz的discuz_application.php  約第350行( _$ [2 R9 ^0 V" A3 c  }% {: E
查找- x  C% \3 i% U8 v, b- Q* w
  1.         private function _xss_check() {
    9 n& `% k: K( {; r4 i# @7 ^

  2. 6 H# ]' |- W4 x
  3.                 static $check = array('"', '>', '<', '\'', '(', ')', 'CONTENT-TRANSFER-ENCODING');  P+ M9 w7 u) Y
  4. , P8 I8 R& F8 D+ p( [  h
  5.                 if(isset($_GET['formhash']) && $_GET['formhash'] !== formhash()) {
    ) f- H. |- M0 O8 @. a
  6.                         system_error('request_tainting');8 u* s7 F0 f+ \9 H/ b1 E
  7.                 }
    ; G) F" R  p: ]9 p

  8. ! n, G) T" l, D
  9.                 if($_SERVER['REQUEST_METHOD'] == 'GET' ) {
    ' c) h; o8 ^" q3 b
  10.                         $temp = $_SERVER['REQUEST_URI'];
    1 Q" z( b) J' I/ t: B4 B
  11.                 } elseif(empty ($_GET['formhash'])) {4 }1 M8 h# X1 h/ Z" X/ ]
  12.                         $temp = $_SERVER['REQUEST_URI'].file_get_contents('php://input');- n, y: ]4 M- I8 _' D
  13.                 } else {
    ' \6 E4 S! s2 _3 u5 G' @4 P
  14.                         $temp = '';2 R; O" |  [% O) @- o7 B
  15.                 }
    4 H9 H( c# O* \1 @

  16. ! V: [- x: r3 J5 M( l
  17.                 if(!empty($temp)) {
    9 W5 L& L5 V: V* q8 J2 M' T7 p
  18.                         $temp = strtoupper(urldecode(urldecode($temp)));
    & |0 I* l) A" j, a* d5 j  A
  19.                         foreach ($check as $str) {8 h1 P* w5 f* p# o2 O  Q: v) ]
  20.                                 if(strpos($temp, $str) !== false) {
    4 {5 L9 [7 \8 a4 @  O, J
  21.                                         system_error('request_tainting');
    4 i1 o1 K/ D" N5 U, {5 K0 I/ w
  22.                                 }  n+ i0 F. Y' x7 P
  23.                         }) \; L0 a( ^' `4 i0 s0 r$ o
  24.                 }
    4 m9 m" H8 K; y; }* y

  25. ! I9 G, b; r. l
  26.                 return true;9 e& q. y! W; @
  27.         }
複製代碼
替换为:  r) W9 b+ |& D" c
8 G! G: Y& U8 l' @( H( F/ u, K
  1.   private function _xss_check() {+ O; U4 `) _* }3 P/ {9 r0 e
  2.     $temp = strtoupper(urldecode(urldecode($_SERVER['REQUEST_URI'])));
    , {7 N0 O" t8 l8 y9 h
  3.     if(strpos($temp, '<') !== false || strpos($temp, '"') !== false || strpos($temp, 'CONTENT-TRANSFER-ENCODING') !== false) {
    6 p1 k: ^  W! ]. Y" x' N* a: R
  4.       system_error('request_tainting');% v8 L% Q, R/ r9 }) y1 w6 ?' G
  5.     }+ j; s+ r: M1 F
  6.     return true;% a& k" N* d, V
  7.   }
複製代碼

& D' q* N2 m/ l) h8 d2 U后台更新缓存   ===>ok
, ~. I/ m" B) {$ Q但 有些 discuz代碼 內容在搜索結果內顯示,曝露在外,是不正常(會員搜索無此問題) ,研究中
7 }" Q4 o$ Z' h' G* p1 r
0 k% P2 Z2 z. g
" h4 }: E" A* \$ z. w1 j




歡迎光臨 52AV手機A片王|52AV.ONE (https://www.52av.one/) Powered by Discuz! X3.2