SECURITY: Fix XSS under IE in closing tags (shared sanitizer)
authorDan
Sat, 17 Jan 2009 15:16:36 -0500
changeset 817 880c4b7eb658
parent 816 44b8446533e1
child 825 9d5c04c1414f
SECURITY: Fix XSS under IE in closing tags (shared sanitizer)
includes/functions.php
--- a/includes/functions.php	Fri Jan 16 13:14:08 2009 -0500
+++ b/includes/functions.php	Sat Jan 17 15:16:36 2009 -0500
@@ -1971,6 +1971,11 @@
   // <
   // The rule is so specific because everything else will have been filtered by now
   $html = preg_replace('/<(script|iframe)(.+?)src=([^>]*)</i', '&lt;\\1\\2src=\\3&lt;', $html);
+  
+  // Vulnerability reported by fuzion from nukeit.org:
+  // XSS in closing HTML tag style attribute
+  // Fix: escape all closing tags with non-whitelisted characters
+  $html = preg_replace('!</((?:.*)([^a-z0-9-_:]+)(?:.*))>!', '&lt;/\\1&gt;', $html);
 
   // Restore stripped comments
   $i = 0;