Fix vulnerability in handling _session argument of utils/save-prefs (#1489382)

pull/139/head
Aleksander Machniak 11 years ago
parent 26830dcc87
commit 70c7df8faa

@ -1,6 +1,7 @@
CHANGELOG Roundcube Webmail CHANGELOG Roundcube Webmail
=========================== ===========================
- Fix vulnerability in handling _session argument of utils/save-prefs (#1489382)
- Fix iframe onload for upload errors handling (#1489379) - Fix iframe onload for upload errors handling (#1489379)
- Fix address matching in Return-Path header on identity selection (#1489374) - Fix address matching in Return-Path header on identity selection (#1489374)
- Fix HTML part detection when encapsulated inside multipart/signed (#1489372) - Fix HTML part detection when encapsulated inside multipart/signed (#1489372)

@ -37,6 +37,7 @@ class rcube_plugin_api
public $output; public $output;
public $handlers = array(); public $handlers = array();
public $allowed_prefs = array(); public $allowed_prefs = array();
public $allowed_session_prefs = array();
protected $plugins = array(); protected $plugins = array();
protected $tasks = array(); protected $tasks = array();

@ -5,7 +5,7 @@
| program/steps/utils/save_pref.inc | | program/steps/utils/save_pref.inc |
| | | |
| This file is part of the Roundcube Webmail client | | This file is part of the Roundcube Webmail client |
| Copyright (C) 2005-2010, The Roundcube Dev Team | | Copyright (C) 2005-2013, The Roundcube Dev Team |
| | | |
| Licensed under the GNU General Public License version 3 or | | Licensed under the GNU General Public License version 3 or |
| any later version with exceptions for skins & plugins. | | any later version with exceptions for skins & plugins. |
@ -21,14 +21,24 @@
$name = get_input_value('_name', RCUBE_INPUT_POST); $name = get_input_value('_name', RCUBE_INPUT_POST);
$value = get_input_value('_value', RCUBE_INPUT_POST); $value = get_input_value('_value', RCUBE_INPUT_POST);
$sessname = get_input_value('_session', RCUBE_INPUT_POST);
// Whitelisted preferences and session variables, others
// can be added by plugins
$whitelist = array( $whitelist = array(
'preview_pane', 'preview_pane',
'list_cols', 'list_cols',
'collapsed_folders', 'collapsed_folders',
'collapsed_abooks', 'collapsed_abooks',
); );
$whitelist_sess = array(
'list_attrib/columns',
);
$whitelist = array_merge($whitelist, $RCMAIL->plugins->allowed_prefs);
$whitelist_sess = array_merge($whitelist_sess, $RCMAIL->plugins->allowed_session_prefs);
if (!in_array($name, array_merge($whitelist, $RCMAIL->plugins->allowed_prefs))) { if (!in_array($name, $whitelist) || ($sessname && !in_array($sessname, $whitelist_sess))) {
raise_error(array('code' => 500, 'type' => 'php', raise_error(array('code' => 500, 'type' => 'php',
'file' => __FILE__, 'line' => __LINE__, 'file' => __FILE__, 'line' => __LINE__,
'message' => sprintf("Hack attempt detected (user: %s)", $RCMAIL->get_user_name())), 'message' => sprintf("Hack attempt detected (user: %s)", $RCMAIL->get_user_name())),
@ -42,7 +52,7 @@ if (!in_array($name, array_merge($whitelist, $RCMAIL->plugins->allowed_prefs)))
$RCMAIL->user->save_prefs(array($name => $value)); $RCMAIL->user->save_prefs(array($name => $value));
// update also session if requested // update also session if requested
if ($sessname = get_input_value('_session', RCUBE_INPUT_POST)) { if ($sessname) {
// Support multidimensional arrays... // Support multidimensional arrays...
$vars = explode('/', $sessname); $vars = explode('/', $sessname);
@ -57,5 +67,3 @@ if ($sessname = get_input_value('_session', RCUBE_INPUT_POST)) {
$OUTPUT->reset(); $OUTPUT->reset();
$OUTPUT->send(); $OUTPUT->send();

Loading…
Cancel
Save