[Svn] r4461 - in trunk/roundcubemail/program: include steps/mail

trac at roundcube.net trac at roundcube.net
Fri Jan 28 16:19:39 CET 2011


Author: thomasb
Date: 2011-01-28 09:19:38 -0600 (Fri, 28 Jan 2011)
New Revision: 4461

Modified:
   trunk/roundcubemail/program/include/main.inc
   trunk/roundcubemail/program/steps/mail/func.inc
Log:
Don't block CSS styles having important keywords

Modified: trunk/roundcubemail/program/include/main.inc
===================================================================
--- trunk/roundcubemail/program/include/main.inc	2011-01-26 21:06:27 UTC (rev 4460)
+++ trunk/roundcubemail/program/include/main.inc	2011-01-28 15:19:38 UTC (rev 4461)
@@ -872,8 +872,8 @@
   $replacements = new rcube_string_replacer;
 
   // ignore the whole block if evil styles are detected
-  $stripped = preg_replace('/[^a-z\(:]/', '', rcmail_xss_entity_decode($source));
-  if (preg_match('/expression|behavior|url\(|import/', $stripped))
+  $stripped = preg_replace('/[^a-z\(:;]/', '', rcmail_xss_entity_decode($source));
+  if (preg_match('/expression|behavior|url\(|import[^a]/', $stripped))
     return '/* evil! */';
 
   // remove css comments (sometimes used for some ugly hacks)

Modified: trunk/roundcubemail/program/steps/mail/func.inc
===================================================================
--- trunk/roundcubemail/program/steps/mail/func.inc	2011-01-26 21:06:27 UTC (rev 4460)
+++ trunk/roundcubemail/program/steps/mail/func.inc	2011-01-28 15:19:38 UTC (rev 4461)
@@ -829,10 +829,10 @@
 
     case 'style':
       // decode all escaped entities and reduce to ascii strings
-      $stripped = preg_replace('/[^a-zA-Z\(:]/', '', rcmail_xss_entity_decode($content));
+      $stripped = preg_replace('/[^a-zA-Z\(:;]/', '', rcmail_xss_entity_decode($content));
 
       // now check for evil strings like expression, behavior or url()
-      if (!preg_match('/expression|behavior|url\(|import/', $stripped)) {
+      if (!preg_match('/expression|behavior|url\(|import[^a]/', $stripped)) {
         $out = html::tag('style', array('type' => 'text/css'), $content);
         break;
       }

_______________________________________________
http://lists.roundcube.net/mailman/listinfo/svn



More information about the Svn mailing list