Changeset 5590 in subversion


Ignore:
Timestamp:
Dec 9, 2011 8:50:03 PM (19 months ago)
Author:
thomasb
Message:

Be more strict in style attribute filtering

Location:
trunk/roundcubemail
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/roundcubemail/program/lib/washtml.php

    r5586 r5590  
    169169              $value .= ' url('.htmlspecialchars($src, ENT_QUOTES) . ')'; 
    170170            } 
    171             else if (preg_match('/^(http|https|ftp):.*$/i', $match[2], $url)) { 
     171            else if (preg_match('!^(https?:)?//[a-z0-9/._+-]+$!i', $match[2], $url)) { 
    172172              if ($this->config['allow_remote']) 
    173173                $value .= ' url('.htmlspecialchars($url[0], ENT_QUOTES).')'; 
  • trunk/roundcubemail/tests/src/BID-26800.txt

    r2323 r5590  
    1111<p>&lt;div&gt; block</p> 
    1212<div style="font-style:italic">valid css</div> 
     13<div style="color:red; background:url('//somedomain.com/somepath/somefile.png')"> 
    1314<div style="{ left:expression( alert(&#039;expression!&#039;) ) }"> 
    1415<div style="{ background:url( alert(&#039;URL!&#039;) ) }"> 
     
    1718<p>Inject comment text</p> 
    1819<div style="{ left:exp/*  */ression( alert(&#039;xss3&#039;) ) }"> 
    19 <div style="{ background:u/* */rl( alert(&#039;xssurl3&#039;) ) }"> 
     20<div style=" background:u/* */rl( alert(&#039;xssurl3&#039;) ) "> 
    2021 
    2122<h1>4 test</h1> 
Note: See TracChangeset for help on using the changeset viewer.