国产精品爱啪在线线免费观看_97视频精品_欧美精品一区二区在线播放_国产欧美久久一区二区三区

新秀網(wǎng)絡(luò)驗(yàn)證系統(tǒng)

標(biāo)題: Discuz!您當(dāng)前的訪(fǎng)問(wèn)請(qǐng)求當(dāng)中含有非法字符,解決方案 [打印本頁(yè)]

作者: Chboy    時(shí)間: 2022-1-12 23:19
標(biāo)題: Discuz!您當(dāng)前的訪(fǎng)問(wèn)請(qǐng)求當(dāng)中含有非法字符,解決方案
Discuz!系統(tǒng)的_xss_check()函數(shù)原本的意義是為了論壇安全,防止XSS攻擊,一般網(wǎng)站使用是不會(huì)出現(xiàn)什么問(wèn)題的,但是有些網(wǎng)站要使用設(shè)置遠(yuǎn)程變量或私人變量的API,當(dāng)API向本站post數(shù)據(jù)的時(shí)候就會(huì)報(bào)"您當(dāng)前的訪(fǎng)問(wèn)請(qǐng)求當(dāng)中含有非法字符,已經(jīng)被系統(tǒng)拒絕",本文介紹一種簡(jiǎn)單的修改方法避免此錯(cuò)誤。

解決方案如下:

\source\class\discuz的discuz_application.php
查找
[PHP] 純文本查看 復(fù)制代碼
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;

}
替換為:

[PHP] 純文本查看 復(fù)制代碼
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;

}

轉(zhuǎn)載請(qǐng)注明來(lái)源于:新秀網(wǎng)絡(luò)驗(yàn)證論壇


作者: admin    時(shí)間: 2022-1-13 10:16
也可以通過(guò)url編碼,進(jìn)行規(guī)避此類(lèi)問(wèn)題。




歡迎光臨 新秀網(wǎng)絡(luò)驗(yàn)證系統(tǒng) (http://www.5566wy.com/) Powered by Discuz! X3.5