Skip to content

Commit 226811a

Browse files
committed
Fix fixed position mitigation bypass via use of !important
Reported by nullcathedral
1 parent fd0e981 commit 226811a

File tree

3 files changed

+5
-1
lines changed

3 files changed

+5
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ This file includes only changes we consider noteworthy for users, admins and plu
1414
- Security: Fix IMAP Injection + CSRF bypass in mail search
1515
- Security: Fix remote image blocking bypass via various SVG animate attributes
1616
- Security: Fix remote image blocking bypass via a crafted body background attribute
17+
- Security: Fix fixed position mitigation bypass via use of !important
1718

1819
## 1.7-rc4
1920

program/lib/Roundcube/rcube_utils.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -552,7 +552,7 @@ public static function sanitize_css_block($styles, $url_callback = null)
552552
if ($property == 'page') {
553553
// Remove 'page' attributes (#7604)
554554
continue;
555-
} elseif ($property == 'position' && strcasecmp($value, 'fixed') === 0) {
555+
} elseif ($property == 'position' && stripos($value, 'fixed') !== false) {
556556
// Convert position:fixed to position:absolute (#5264)
557557
$value = 'absolute';
558558
} elseif (preg_match('/expression|image-set/i', $value)) {

tests/Framework/UtilsTest.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -341,6 +341,9 @@ public function test_mod_css_styles_xss()
341341
$mod = \rcube_utils::mod_css_styles('.test { position: fixed; top: 0;', 'rcmbody');
342342
$this->assertSame('#rcmbody .test { position: absolute; top: 0; }', $mod, 'Replace position:fixed with position:absolute (6)');
343343

344+
$mod = \rcube_utils::mod_css_styles('.test { position: fixed !important; }', 'rcmbody');
345+
$this->assertSame('#rcmbody .test { position: absolute; }', $mod, 'Replace position:fixed with position:absolute (7)');
346+
344347
// allow data URIs with images (#5580)
345348
$mod = \rcube_utils::mod_css_styles('body { background-image: url(data:image/png;base64,123); }', 'rcmbody');
346349
$this->assertStringContainsString('#rcmbody { background-image: url(data:image/png;base64,123);', $mod, 'Data URIs in url() allowed [1]');

0 commit comments

Comments
 (0)