Additional XSS checks #1088

This commit is contained in:
Kijin Sung 2018-09-18 13:27:55 +09:00
parent e03ccbd7a9
commit 19331e6746
2 changed files with 12 additions and 11 deletions

View file

@ -67,7 +67,11 @@ class UploadFileFilter
*/
protected static function _checkSVG($fp, $from, $to)
{
if (self::_matchStream('/<script|xlink:href\s*=\s*"(?!data:)/i', $fp, $from, $to))
if (self::_matchStream('/<script|<handler\b|xlink:href\s*=\s*"(?!data:)/i', $fp, $from, $to))
{
return false;
}
if (self::_matchStream('/\b(?:ev:(?:event|listener|observer)|on[a-z]+)\s*=/i', $fp, $from, $to))
{
return false;
}