ci xss 过滤正则问题
hello! ci中core/security.php 中的_remove_evil_attributes中一个正则"#<(/?[^><]+?)([^A-Za-z\-])(".implode('|', $evil_attributes).")(\s*=\s*)([\"][^>]*?[\"]|[\'][^>]*?[\']|[^>]*?)([\s><])([><]*)#i"
最后一个括号是否应该去掉呢? 追问2:
protected function _js_img_removal($match)
{
$attributes = $this->_filter_attributes(str_replace(array('<', '>'), '', $match));
return str_replace($match, preg_replace("#src=.*?(alert\(|alert&\#40;|javascript\:|livescript\:|mocha\:|charset\=|window\.|document\.|\.cookie|<script|<xss|base64\s*,)#si", "", $attributes), $match);
}
如果 $attributes=‘src="http://www.baidu.com/img/php.cookie.jpg"’这个路径是正常的但受到了过滤
,还有 onload,onerror 两个顽皮的属性没过滤 看到正则就怕怕...!!!!!!
页:
[1]