Aleksander Machniak
2016-05-06 acf633c73bc8df9a5036bc52d7568f4213ab73c7
Fix XSS issue in href attribute on area tag (#5240, #5241)

Conflicts:

CHANGELOG
3 files modified
21 ■■■■■ changed files
CHANGELOG 2 ●●●●● patch | view | raw | blame | history
program/lib/Roundcube/rcube_washtml.php 2 ●●● patch | view | raw | blame | history
tests/Framework/Washtml.php 17 ●●●●● patch | view | raw | blame | history
CHANGELOG
@@ -1,6 +1,8 @@
CHANGELOG Roundcube Webmail
===========================
- Fix XSS issue in href attribute on area tag (#5240)
RELEASE 1.0.9
-------------
- Fix a regression where some contact data was missing in export and PHP warnings were logged (Kolab #4522)
program/lib/Roundcube/rcube_washtml.php
@@ -366,7 +366,7 @@
     */
    private function is_link_attribute($tag, $attr)
    {
        return $tag == 'a' && $attr == 'href';
        return ($tag == 'a' || $tag == 'area') && $attr == 'href';
    }
    /**
tests/Framework/Washtml.php
@@ -38,6 +38,23 @@
    }
    /**
     * Test XSS in area's href (#5240)
     */
    function test_href_area()
    {
        $html = '<p><area href="data:text/html,&lt;script&gt;alert(document.cookie)&lt;/script&gt;">'
            . '<area href="vbscript:alert(document.cookie)">Internet Explorer</p>'
            . '<area href="javascript:alert(document.domain)" shape=default>';
        $washer = new rcube_washtml;
        $washed = $washer->wash($html);
        $this->assertNotRegExp('/data:text/', $washed, "data:text/html in area href");
        $this->assertNotRegExp('/vbscript:/', $washed, "vbscript: in area href");
        $this->assertNotRegExp('/javascript:/', $washed, "javascript: in area href");
    }
    /**
     * Test handling HTML comments
     */
    function test_comments()