From 854397b216463d77561b8adadf880c3fbbcb8885 Mon Sep 17 00:00:00 2001
From: thomascube <thomas@roundcube.net>
Date: Fri, 09 Dec 2011 20:33:58 -0500
Subject: [PATCH] Better CSS url() validation

---
 program/steps/mail/func.inc |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/program/steps/mail/func.inc b/program/steps/mail/func.inc
index a0a4dca..2bc0091 100644
--- a/program/steps/mail/func.inc
+++ b/program/steps/mail/func.inc
@@ -834,8 +834,8 @@
       $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/i', $stripped)) {
-        if (!$washtml->get_config('allow_remote') && preg_match('/url\(|import[^a]/i', $stripped))
+      if (!preg_match('/expression|behavior|javascript:|import[^a]/i', $stripped)) {
+        if (!$washtml->get_config('allow_remote') && stripos($stripped, 'url('))
           $washtml->extlinks = true;
         else
           $out = html::tag('style', array('type' => 'text/css'), $content);

--
Gitblit v1.9.1