Skip to content

Commit

Permalink
Fix possible IMAP command injection and type juggling vulnerabilities (
Browse files Browse the repository at this point in the history
  • Loading branch information
alecpl committed Apr 3, 2018
1 parent 891d01a commit 8b0540d
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ CHANGELOG Roundcube Webmail
- Fix so links over images are not removed in plain text signatures converted from HTML (#4473)
- Fix various issues when downloading files with names containing non-ascii chars, use RFC 2231 (#5772)
- Fix parsing date strings (e.g. from a Date: mail header) with comments (#6216)
- Fix possible IMAP command injection and type juggling vulnerabilities (#6229)

RELEASE 1.3.5
-------------
Expand Down
4 changes: 2 additions & 2 deletions program/lib/Roundcube/rcube.php
Original file line number Diff line number Diff line change
Expand Up @@ -916,7 +916,7 @@ public function check_request($mode = rcube_utils::INPUT_POST)
$sess_tok = $this->get_request_token();

// ajax requests
if (rcube_utils::request_header('X-Roundcube-Request') == $sess_tok) {
if (rcube_utils::request_header('X-Roundcube-Request') === $sess_tok) {
return true;
}

Expand All @@ -931,7 +931,7 @@ public function check_request($mode = rcube_utils::INPUT_POST)
$token = rcube_utils::get_input_value('_token', $mode);
$sess_id = $_COOKIE[ini_get('session.name')];

if (empty($sess_id) || $token != $sess_tok) {
if (empty($sess_id) || $token !== $sess_tok) {
$this->request_status = self::REQUEST_ERROR_TOKEN;
return false;
}
Expand Down
10 changes: 6 additions & 4 deletions program/lib/Roundcube/rcube_imap_generic.php
Original file line number Diff line number Diff line change
Expand Up @@ -3865,13 +3865,13 @@ public static function compressMessageSet($messages, $force=false)

if (!is_array($messages)) {
// if less than 255 bytes long, let's not bother
if (!$force && strlen($messages)<255) {
return $messages;
if (!$force && strlen($messages) < 255) {
return preg_match('/[^0-9:,]/', $messages) ? 'INVALID' : $messages;
}

// see if it's already been compressed
if (strpos($messages, ':') !== false) {
return $messages;
return preg_match('/[^0-9:,]/', $messages) ? 'INVALID' : $messages;
}

// separate, then sort
Expand Down Expand Up @@ -3906,7 +3906,9 @@ public static function compressMessageSet($messages, $force=false)
}

// return as comma separated string
return implode(',', $result);
$result = implode(',', $result);

return preg_match('/[^0-9:,]/', $result) ? 'INVALID' : $result;
}

/**
Expand Down

0 comments on commit 8b0540d

Please sign in to comment.