From e6d376236ee5bfb36c4cf11719500d6bdedcc535 Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Wed, 27 Mar 2013 16:32:51 +0100 Subject: Whitelist configuration options (user preferences) that can be changed using save-pref command --- program/steps/utils/save_pref.inc | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'program/steps/utils') diff --git a/program/steps/utils/save_pref.inc b/program/steps/utils/save_pref.inc index b550ad7ef..7def8733d 100644 --- a/program/steps/utils/save_pref.inc +++ b/program/steps/utils/save_pref.inc @@ -21,6 +21,22 @@ $name = get_input_value('_name', RCUBE_INPUT_POST); $value = get_input_value('_value', RCUBE_INPUT_POST); +$whitelist = array( + 'preview_pane', + 'list_cols', + 'collapsed_folders', + 'collapsed_abooks', +); + +if (!in_array($name, array_merge($whitelist, $RCMAIL->plugins->allowed_prefs))) { + raise_error(array('code' => 500, 'type' => 'php', + 'file' => __FILE__, 'line' => __LINE__, + 'message' => sprintf("Hack attempt detected (user: %s)", $RCMAIL->get_user_name())), + true, false); + + $OUTPUT->reset(); + $OUTPUT->send(); +} // save preference value $RCMAIL->user->save_prefs(array($name => $value)); -- cgit v1.2.3