Changeset 5589 in subversion
- Timestamp:
- Dec 9, 2011 8:33:58 PM (18 months ago)
- Location:
- trunk/roundcubemail
- Files:
-
- 3 edited
-
CHANGELOG (modified) (1 diff)
-
program/include/main.inc (modified) (1 diff)
-
program/steps/mail/func.inc (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/roundcubemail/CHANGELOG
r5564 r5589 2 2 =========================== 3 3 4 - Make Roundcube render the Email Standards Project Acid Test correctly 4 5 - Deprecate $DB, $USER, $IMAP global variables, Use $RCMAIL instead 5 6 - Add option to set default font for HTML message (#1484137) -
trunk/roundcubemail/program/include/main.inc
r5586 r5589 892 892 $source = rcmail_xss_entity_decode($source); 893 893 $stripped = preg_replace('/[^a-z\(:;]/i', '', $source); 894 $evilexpr = 'expression|behavior' . (!$allow_remote ? '|url\(|import[^a]' : ''); 895 if (preg_match("/$evilexpr/i", $stripped) // don't accept No-Gos 896 || (strpos($stripped, 'url(') && !preg_match('!url\s*\([ "\'](https?:)//[a-z0-9/._+-]+["\' ]\)!Ui', $source))) // only allow clean urls 894 $evilexpr = 'expression|behavior|javascript:|import[^a]' . (!$allow_remote ? '|url\(' : ''); 895 if (preg_match("/$evilexpr/i", $stripped)) 897 896 return '/* evil! */'; 898 897 899 898 // cut out all contents between { and } 900 while (($pos = strpos($source, '{', $last_pos)) && ($pos2 = strpos($source, '}', $pos))) 901 { 902 $key = $replacements->add(substr($source, $pos+1, $pos2-($pos+1))); 899 while (($pos = strpos($source, '{', $last_pos)) && ($pos2 = strpos($source, '}', $pos))) { 900 $styles = substr($source, $pos+1, $pos2-($pos+1)); 901 902 // check every line of a style block... 903 if ($allow_remote) { 904 $a_styles = preg_split('/;[\r\n]*/', $styles, -1, PREG_SPLIT_NO_EMPTY); 905 foreach ($a_styles as $line) { 906 $stripped = preg_replace('/[^a-z\(:;]/i', '', $line); 907 // ... and only allow strict url() values 908 if (stripos($stripped, 'url(') && !preg_match('!url\s*\([ "\'](https?:)//[a-z0-9/._+-]+["\' ]\)!Uims', $line)) { 909 $a_styles = array('/* evil! */'); 910 break; 911 } 912 } 913 $styles = join(";\n", $a_styles); 914 } 915 916 $key = $replacements->add($styles); 903 917 $source = substr($source, 0, $pos+1) . $replacements->get_replacement($key) . substr($source, $pos2, strlen($source)-$pos2); 904 918 $last_pos = $pos+2; -
trunk/roundcubemail/program/steps/mail/func.inc
r5588 r5589 835 835 836 836 // now check for evil strings like expression, behavior or url() 837 if (!preg_match('/expression|behavior /i', $stripped)) {838 if (!$washtml->get_config('allow_remote') && preg_match('/url\(|import[^a]/i', $stripped))837 if (!preg_match('/expression|behavior|javascript:|import[^a]/i', $stripped)) { 838 if (!$washtml->get_config('allow_remote') && stripos($stripped, 'url(')) 839 839 $washtml->extlinks = true; 840 840 else
Note: See TracChangeset
for help on using the changeset viewer.
