aboutsummaryrefslogtreecommitdiffstats
path: root/main/roundcubemail/save_prefs_vulnerability_fix_0.6.patch
blob: ef8c14b9e2eae17fa1f26dab6e9e3c77cc42f64c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
--- a/program/steps/utils/save_pref.inc	2013-03-27 17:16:36.000000000 +0100
+++ b/program/steps/utils/save_pref.inc	2013-03-27 17:17:33.000000000 +0100
@@ -21,6 +21,21 @@
 
 $name = get_input_value('_name', RCUBE_INPUT_POST);
 $value = get_input_value('_value', RCUBE_INPUT_POST);
+$whitelist = array(
+    'preview_pane',
+    'list_cols',
+    'collapsed_folders',
+);
+
+if (!in_array($name, $whitelist)) {
+    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));