diff --git a/CHANGELOG b/CHANGELOG index e2f96ff7a..f1faa633d 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -80,9 +80,10 @@ CHANGELOG Roundcube Webmail - Fix bug where unread count wasn't updated after moving multi-folder result (#6846) - Fix wrong messages order after returning to a multi-folder search result (#6836) - Fix some PHP 7.4 compat. issues (#6884, #6866) -- Fix security issue where it was possible to bypass the position:fixed CSS check in received messages (#6898) +- Fix bug where it was possible to bypass the position:fixed CSS check in received messages (#6898) - Fix bug where some strict remote URIs in url() style were unintentionally blocked (#6899) -- Fix security issue where it was possible to bypass the CSS jail in HTML messages using :root pseudo-class (#6897) +- Fix bug where it was possible to bypass the CSS jail in HTML messages using :root pseudo-class (#6897) +- Fix bug where it was possible to bypass href URI check with data:application/xhtml+xml URIs (#6896) RELEASE 1.4-rc1 --------------- diff --git a/program/lib/Roundcube/rcube_washtml.php b/program/lib/Roundcube/rcube_washtml.php index 468491fb0..516a12471 100644 --- a/program/lib/Roundcube/rcube_washtml.php +++ b/program/lib/Roundcube/rcube_washtml.php @@ -320,7 +320,7 @@ class rcube_washtml $out = $this->wash_uri($value, true); } else if ($this->is_link_attribute($node->nodeName, $key)) { - if (!preg_match('!^(javascript|vbscript|data:text)!i', $value) + if (!preg_match('!^(javascript|vbscript|data:)!i', $value) && preg_match('!^([a-z][a-z0-9.+-]+:|//|#).+!i', $value) ) { $out = $value; diff --git a/tests/Framework/Washtml.php b/tests/Framework/Washtml.php index 2ffebec27..0f38495ed 100644 --- a/tests/Framework/Washtml.php +++ b/tests/Framework/Washtml.php @@ -19,19 +19,21 @@ class Framework_Washtml extends PHPUnit_Framework_TestCase /** * Test the elimination of some XSS vulnerabilities */ - function test_html_xss3() + function test_html_xss() { // #1488850 - $html = '

Firefox' + $html = 'Firefox' .'Internet Explorer

' - .'

Firefox' - .'Internet Explorer

'; + .'Firefox' + .'Internet Explorer' + .'CLICK ME'; // #6896 $washer = new rcube_washtml; $washed = $washer->wash($html); $this->assertNotRegExp('/data:text/', $washed, "Remove data:text/html links"); $this->assertNotRegExp('/vbscript:/', $washed, "Remove vbscript: links"); + $this->assertNotRegExp('/data:application/', $washed, "Remove data:application links"); } /**