Changeset 2245 in subversion
- Timestamp:
- Jan 20, 2009 11:28:33 AM (4 years ago)
- Location:
- trunk/roundcubemail
- Files:
-
- 2 edited
-
CHANGELOG (modified) (1 diff)
-
program/lib/washtml.php (modified) (3 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/roundcubemail/CHANGELOG
r2242 r2245 1 1 CHANGELOG RoundCube Webmail 2 2 --------------------------- 3 4 2009/01/20 (thomasb) 5 ---------- 6 - Fix XSS vulnerability through background attributes as reported by Julien Cayssol 3 7 4 8 2009/01/18 (alec) -
trunk/roundcubemail/program/lib/washtml.php
r1811 r2245 81 81 82 82 /* Allowed HTML attributes */ 83 static $html_attribs = array('name', 'class', 'title', 'alt', 'width', 'height', 'align', 'nowrap', 'col', 'row', 'id', 'rowspan', 'colspan', 'cellspacing', 'cellpadding', 'valign', 'bgcolor', 'color', 'border', 'bordercolorlight', 'bordercolordark', 'face', 'marginwidth', 'marginheight', 'axis', 'border', 'abbr', 'char', 'charoff', 'clear', 'compact', 'coords', 'vspace', 'hspace', 'cellborder', 'size', 'lang', 'dir' , 'background');83 static $html_attribs = array('name', 'class', 'title', 'alt', 'width', 'height', 'align', 'nowrap', 'col', 'row', 'id', 'rowspan', 'colspan', 'cellspacing', 'cellpadding', 'valign', 'bgcolor', 'color', 'border', 'bordercolorlight', 'bordercolordark', 'face', 'marginwidth', 'marginheight', 'axis', 'border', 'abbr', 'char', 'charoff', 'clear', 'compact', 'coords', 'vspace', 'hspace', 'cellborder', 'size', 'lang', 'dir'); 84 84 85 85 /* State for linked objects in HTML */ … … 161 161 $value = $node->getAttribute($key); 162 162 if(isset($this->_html_attribs[$key]) || 163 ($key == 'href' && preg_match('/^(http|https|ftp|mailto):. */i', $value)))163 ($key == 'href' && preg_match('/^(http|https|ftp|mailto):.+/i', $value))) 164 164 $t .= ' ' . $key . '="' . htmlspecialchars($value, ENT_QUOTES) . '"'; 165 165 else if($key == 'style' && ($style = $this->wash_style($value))) 166 166 $t .= ' style="' . $style . '"'; 167 else if($key == ' src' && strtolower($node->tagName) == 'img') { //check tagName anyway167 else if($key == 'background' || ($key == 'src' && strtolower($node->tagName) == 'img')) { //check tagName anyway 168 168 if($src = $this->config['cid_map'][$value]) { 169 169 $t .= ' ' . $key . '="' . htmlspecialchars($src, ENT_QUOTES) . '"'; 170 170 } 171 else if(preg_match('/^(http|https|ftp):. */i', $value)) {171 else if(preg_match('/^(http|https|ftp):.+/i', $value)) { 172 172 if($this->config['allow_remote']) 173 173 $t .= ' ' . $key . '="' . htmlspecialchars($value, ENT_QUOTES) . '"'; … … 175 175 $this->extlinks = true; 176 176 if ($this->config['blocked_src']) 177 $t .= ' src="' . htmlspecialchars($this->config['blocked_src'], ENT_QUOTES) . '"';177 $t .= ' ' . $key . '="' . htmlspecialchars($this->config['blocked_src'], ENT_QUOTES) . '"'; 178 178 } 179 179 }
Note: See TracChangeset
for help on using the changeset viewer.
