PHP ボードを持っていますが、XSS セキュリティ リークが含まれています。
IE6 の URL アドレス フィールドに次の XSS を挿入すると、
http://x.x.x.x/xe/?mid=notice&category='"--></style></script><script>alert(0x000640)</script>
'"--></style></script><script>alert(0x000640)</script>
( XSSコードは
こちら)
ブラウザは 1600 の警告メッセージを表示します (上記のコードをスクリプトとして変換します)
XSSを防ぐために、次のコードを挿入しました(if(preg_match('/"/',$target)) return true;
)
function _isHackedSrc($src) {
if(!$src) return false;
if($src) {
$target = trim($src);
if(preg_match('/(\s|(\&\#)|(script:))/i', $target)) return true;
if(preg_match('/data:/i', $target)) return true;
$url_info = parse_url($src);
$query = $url_info['query'];
if(!trim($query)) return false;
$query = str_replace("&","&",$query);
$queries = explode('&', $query);
$cnt = count($queries);
for($i=0;$i<$cnt;$i++) {
$tmp_str = strtolower(trim($queries[$i]));
$pos = strpos($tmp_str,'=');
if($pos === false) continue;
$key = strtolower(trim(substr($tmp_str, 0, $pos)));
$val = strtolower(trim(substr($tmp_str,$pos+1)));
if( ($key=='module'&&$val=='admin') || ($key=='act'&&preg_match('/admin/i',$val)) ) return true;
}
}
return false;
}
しかし、それは機能しません。私を助けてください